2013-08-09

How to extract MP3 audio from ASF in Linux environment

COMMAND :
for files in $(ls); do avconv -i $(files) -vn -acodec wmav2 -f asf ${files:0:2}".mp3"; done

If FILES are
01.asf
02.asf
03.asf

2013-06-29

Manage multiple SSH private keys

There are 2 ways to manage multiple SSH private keys.

Step 0. Create a file named ~/.ssh/config

Step 1-1st, SSH can be configured with both host names and their identity files.

Host server1.remote.host
IdentityFile ~/.ssh/server1.remote.host.privatekey
Host server2.remote.host
IdentityFile ~/.ssh/server2.remote.host.privatekey

Step 1-2nd, SSH can be configured with a per-user configuration file.

$ vi config
Type the followings...

IdentityFie ~/.ssh/id_dsa_%h_%r
IdentityFie ~/.ssh/id_rsa_%h_%r
IdentityFie ~/.ssh/id_dsa
IdentityFie ~/.ssh/id_rsa

Save and quit.

$ssh username@remote.host

=> SSH client will try to read the private key at one of the following files
~/.ssh/id_dsa_remote.host_username
~/.ssh/id_rsa_remote.host_username
~/.ssh/id_dsa
~/.ssh/id_rsa

2013-01-18

How to setup virtual directory with PHP support on Nginx

Setup virtual directory with PHP support.
location /phpmyadmin {
    alias /opt/phpmyadmin/;
    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }
}

When to use mutliple virtual directories, seperate and include the configuration.
Create /etc/nginx/conf.d/php.inc
location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
}

Include above file into the virtual directory configuration.
location /phpmyadmin {
    alias /opt/phpmyadmin/;
    include /etc/nginx/conf.d/php.inc;
}