Random Pointers

Here I’ll keep some links that for some reason turned out to be useful. It will probably end up as a repository for tech stuff, but whatever. After all, as a former teacher used to say,

Internet, not computing, is the human tapestry.

http://www.linuxjournal.com/article/2156 -> fun with named pipes in bash

I’ve been bitten by this one time too many. So you have a wireless card in your laptop, and you want to use different
settings depending if you’re either at work or at home. Well, the solution is to use logical interface definitions. Here’s
the relevant part of /etc/network/interfaces:

auto wlan0
iface wlan0 inet dhcp
[ … wireless config stuff here … ]

# start this like ifup wlan0=whome
auto whome
iface whome inet dhcp
pre-up wpa_supplicant -Dwext -B -iwlan0 -c/etc/wpa_supplicant.conf
post-down killall -q wpa_supplicant

By default wireless config will be like in the first stanza; to change it (i.e. when you get home) bring it down (ifdown wlan0) and then bring it up again like shown in the comment line before the second stanza.

Final note: that wpa_supplicant line used to include the option ‘-Bw’ instead of just ‘-B’, but it appears that the ‘w’ option was removed.

If you want to install a chroot from one ubuntu version, inside another one (or even create a chroot with the same version that is installed in the main host, than this is your guide -> https://wiki.ubuntu.com/DebootstrapChroot

If however, you want to create a Debian chroot inside you existing ubuntu, you will run into some trouble with the aforementioned guide. You’re much better of with this one -> https://trac.parrot.org/parrot/wiki/ChrootSetup

In particular, if you want to map the users from the main host to the chroot system (useful to be able to map and properly use /home, for example), for a Debian chroot the file /etc/gshadow is required, whilst for an ubuntu chroot it is not.

Funny thing, when you install Ubuntu, at least when you install Intrepid Ibex (amd64, alternate), you’re not a part of the “users” group… Which gives for some very odd things to start happening, for example being unable to compile certain LaTeX files (in this case, those which T1 encoding). But in any case, the solution is quite simple, just add the user in question to that group, and presto, it works again.

Nice script to monitor memory usage in Linux (2.6) -> here

To merge several documents into one (a PDF, for instance), use ImageMagick:

convert -define pdf:use-trimbox=true Image-001.png Image-002.png Image-003.png merged_document.pdf

In Perl, to print a string in hex, do like this:

my $str = ‘ABCD’;
$str =~ s/(.)/ sprintf ‘%02x’, ord $1 /seg;
print “$str\n”; # hex version of orig string

To rip audio from youtube, with decent quality, download the flv video file, and then do this:

ffmpeg -i file.flv -ab 128000 -ar 44100 new_file_name.mp3

Incidently, if afterwords you think that the volume of the mp3 is too low, you can raise it with Audacity

In Firefox, to duplicate a tab, extension is needed: just press Ctrl key and drag the tab horizontally, like if you wanted to switch it one place to either left or right. When you release the mouse and Ctrl, the tab will duplicated.