Tuesday, October 28, 2008

Removing bash arguments

Use shift to remove the first ($1) argument from $@, as explained here in example 9-6.

Saturday, October 25, 2008

use flac tags to rename files


for a in *.flac; do
ARTIST=`metaflac "$a" --show-tag=ARTIST | sed s/.*=//g`
TITLE=`metaflac "$a" --show-tag=TITLE | sed s/.*=//g`
TRACKNUMBER=`metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g`
mv "$a" "`printf %02g $TRACKNUMBER` - $ARTIST - $TITLE.flac"

(Also see the post on converting flac to mp3s)

Sunday, October 19, 2008

GPU fan runs endlessly after upgrade to Ubuntu Intrepid Ibex

After upgrading to Ubuntu Intrepid Ibex with a Dell Latitude D630 (nVidia Quadro NVS 135M GPU) and using the nVidia driver 177, my GPU fan started to run for two seconds, pause for one, repeat that a few times, and finally run on full speed endlessly. Others had similar problems, e.g. with a Dell XPS M1330 with GeForce 8400M GS, as can be read in this bug report.

One workaround is to switch back to the nVidia 173 driver (which however is not marked as recommended). Another option is to upgrade to the newest Dell BIOS (in my case A13, but A12 also appears to work).

Monday, October 13, 2008

skype and Logitech webcam in Ubuntu Intrepid Ibex 64-bit

There's a bug report on why many webcams stopped to work in Ubuntu Intrepid Ibex.

Here's a workaround using LD_PRELOAD:

sudo apt-get install lib32v4l-0 libv4l-0

(to have both the 32-bit and 64-bit versions.)

For camorama, which is a 64-bit application:

LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so camorama

For skype, which is a 32-bit application:

LD_PRELOAD=/usr/lib32/libv4l/v4l1compat.so skype

(skype can be found in the medibuntu repositories.)

Sunday, October 12, 2008

export firefox 3 cookies to cookies.txt file

Firefox 3 stores cookies in a SQL database. Having the cookies in a simple cookies.txt file can be helpful for using wget --load-cookies.

A python script to convert the SQL database cookies to the simple text file format can be found here. The corresponding original blog post (German only) is here.

The comments for the blog post above also mention a more advanced version with option parsing.

Modmap settings to combine US layout and German umlauts

The following .Xmodmap file should work to modify an US layout to give German umlauts when the corresponding keys are pressed together with the right Alt key:

! Xorg 8.10 has different keycode for Right-Alt
! keycode 113 = Mode_switch
keycode 108 = Mode_switch
keycode 20 = minus underscore ssharp
keycode 34 = bracketleft braceleft udiaeresis Udiaeresis
keycode 47 = semicolon colon odiaeresis Odiaeresis
keycode 48 = apostrophe quotedbl adiaeresis Adiaeresis
keycode 26 = e E EuroSign

This should work for Xorg 8.10 (e.g Ubuntu Intrepid Ibex, previously the keycode for the right Alt key was 113). This came as a bit of a surprise, as my left arrow key and the umlauts didn't work anymore after upgrading to Ubuntu Intrepid Ibex.

The keycodes for keys can easily be found using xev.