eth names in CentOS

To make sure particular device name will be assigned to particular ethernet card (there are 2 on my server) I needed to do the following:

$ vi /etc/udev/rules.d/70-persistent-net.rules 
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:ef:88:45:88:44", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="90:e6:ba:ef:80:db", NAME="eth1"

Configuring static IP for wlan0 on Raspberry Pi

Recently I bought Raspberry Pi just for fun and some tests.

Today I bought a wireless adapter for it: ASUS USB-N10 (no needs to play with drivers or anything) and tried to configure the network. So after some docs reading and tries – this is working config (the network I used at this moment had WEP key, for WPA you must use other settings):

$ cat /etc/network/interfaces 
auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet static
	address 192.168.2.57
	netmask 255.255.0.0
	gateway 192.168.2.1
	dns-nameservers 8.8.8.8
	wireless-essid mynetid
	wireless-key s:keymustbehere

Remove files / directories older than N days

Looked for the simple command today and here it is:

find <path to files> -mtime +N -type f -delete
find <path to directories> -mtime +N -type d -delete

Where +N is how many days ago.
So in case of 2 days it should be: -mtime +2

How to get list of indexes in MySQL

This is query which returns the list of indexes in mysql:

SELECT table_name,
       index_name,
       GROUP_CONCAT(column_name ORDER BY seq_in_index) as 'columns_list'
FROM information_schema.statistics
GROUP BY table_name, index_name;

Install Percona repo on Fedora 17

While trying to install Percona repo on Fedora 17 I got an error:

[user@fedora17 ~]$ yum list | grep percona
http://repo.percona.com/centos/17/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found : http://repo.percona.com/centos/17/os/x86_64/repodata/repomd.xml
Trying other mirror.
Error: failure: repodata/repomd.xml from percona: [Errno 256] No more mirrors to try.

The fix is easy: update baseurl for Percona repo (/etc/yum.repos.d/Percona.repo)
Continue reading