Things I don't want to look for twice..

Monthly Archives: October 2011

puppet dashboard apt repository

On puppet website it says you should add the key with

gpg –recv-key 4BD6EC30

gpg -a –export 4BD6EC30 | sudo apt-key add –

but you should really use a keyserver. Fortunately, ubuntu has the key:

apt-key adv –keyserver –recv-key 4BD6EC30

wireless-N on Dlink DIR-635

I’ve been very frustrated about my Dlink DIR-635 not working N-mode, although it’s a wireless-N router and I have only wireless-N devices in my home. So yesterday, I thought I’d force only wireless-N coming out from my router. (I have multiple choices and combinations between B, G and N) And when I tried that, a popup appeared letting me know I can’t use wireless-N only using TKIP encryption. FUCK! I’ve been using TKIP (instead of AES) for a long time now, and since then, I’ve been using only wireless-G speed. So, I’ve switched to AES encryption and now all devices are connecting on speeds much greater than 54Mbps.

moodle using multiple hostnames

I’ve been trying to make moodle work with 2 hostnames:, external, accessible from Internet, and moodle.domain.local, a local domain, accessible only from local LAN. Unfortunately, moodle redirected users from to moodle.domain.local, because at setup, the local domain was set. I’ve set up Apache using IP based virtual hosts, but still nothing. Users were redirected. After googling a little, I’ve found the solution for this crap. You have to edit config.php file in the root of moodle like this:

– instead of:

$CFG->wwwroot   = ‘http://moodle.domain.local;

– you should have:

$CFG->wwwroot   = ‘http://’.$_SERVER[‘HTTP_HOST’];

Like this, will use the hostname in URL. Considering it’s IP based virtualhost, it will not change the home dir for the website, and uses Apache variable which is exactly what you need the wwwroot variable in moodle.

replace TABs with spaces in text file using sed

I found this on a website, and worked for me:

sed -i 's/[--TAB--]/ /g' file.txt
In place of --TAB-- , give CTRL + V followed by TAB.

Very simple, very effective.

inodes on ext4

I had to create a partition of 100GB with a very large number of inodes, 6 millions just wasn’t enough. So I’ve created a ext4 partition of 100GB with 1024 block size and 250.000.000 inodes like this:

mkfs.ext4 -N 250000000 -b 1024 /dev/mapper/lv_name