Monday, December 28, 2009

Don't open Gnome window when mounting disks

Open the File Browser, go to Edit -> Preferences, select the Media tab, untick "Browse media when inserted".

Monday, November 9, 2009

Reload executables found in PATH environment variable directories

To clear the corresponding cache, simply set the PATH variable again.

bash: PATH=$PATH

tcsh: setenv PATH $PATH

Saturday, September 26, 2009

Recovering bad sheevaplug kernel flash

After having flashed a "bad" kernel onto the sheevaplug that doesn't boot anymore, not all is lost. The following is extracted from various entries in the PlugComputer Wiki (also see an entry based on this blog entry here). It assumes that the U-Boot boot loader is still working.

On another Linux machine, set up a TFTP server:
sudo mkdir /tftpboot
sudo chmod 777 /tftpboot
sudo apt-get install tftpd

Edit /etc/inetd.conf:
tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /tftpboot

Restart the TFTP server:
sudo /etc/init.d/openbsd-inetd restart

Put a "good" (i.e. usually older) kernel uImage file into /tftpboot. You can get such an image e.g. from here.

Connect to the sheevaplug using the serial console:
sudo modprobe ftdi_sio vendor=0x9e88 product=0x9e8f
screen /dev/ttyUSB1 115200

(Or use /dev/ttyUSB0, this depends.)

Reset the sheevaplug by pushing a needle or paper-clip into the small hole near the serial port connector. Stop the boot sequence by pressing a key.

Connect the sheevaplug to the ethernet network. Set own and the TFTP server IP address:
setenv ipaddr
setenv serverip

Load the kernel image:
tftpboot 0x2000000 sheeva-2.6.31-uImage

Set needed bootargs, e.g.
setenv arcNumber 2097
setenv mainlineLinux yes
setenv bootargs rootfstype=jffs2 console=ttyS0,115200 mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mtdblock1 rw ip=

Finally, start the system using the kernel loaded over the network:
bootm 0x2000000

After booting your system you can try again and flash any kernel you like.

Wednesday, August 26, 2009

vim: keep or delete lines matching a pattern

This is similar to a grep on the local buffer. To delete all lines matching a certain regular expression pattern, use
To do the opposite, i.e. only keep those lines matching the pattern, use
And to only temporarily print matching lines, use

Saturday, July 25, 2009

Disable PDF display in Firefox

For Ubuntu Jaunty, the Adobe Acrobat (acroread) browser plug-in is not separate in the package mozilla-acroread anymore. Instead it is part of acroread unfortunately. One can simply remove the plug-in though using
sudo rm `locate`
and restarting the browser.
Usually the plug-in is located here:

Sunday, May 3, 2009

Add newline at the end of files

A simple Python script to automatically append newlines at the end of files, to make some compilers (especially some gcc versions) happy. It recursively looks for all files with extensions .cpp or .h and appends a newline if necessary.

#!/usr/bin/env python

import os, glob

# file extensions to search for
extensions = ('.cpp', '.h')

def process_file(filename):
    f = open(filename, 'r')
    last_line = f.readlines()[-1]
    # check if we need to append a newline
    if len(last_line.strip()) > 0:
        f = open(filename, 'a')
        print >> f, '\n'

def process_dir(dirname):
    for f in glob.glob('%s/*' % dirname):
        if os.path.isdir(f): # recurse
        elif f.endswith(extensions):

if __name__ == '__main__':

Sunday, April 26, 2009

xxdiff and svn

sudo apt-get install xxdiff-scripts
Then use xx-svn-diff instead of svn diff.

Friday, February 20, 2009

abcde configuration

LAMEOPTS="--preset standard"

Sunday, February 15, 2009

jerky green video output with mplayer and xv

After an upgrade to Ubuntu Jaunty, my mplayer video output (using -vo xv) was completely green and jerky. It turned out that during the upgrade apparently the proprietary nvidia driver was disabled. You simply need to reenable it at System -> Administration -> Hardware Drivers and reboot to fix the problem.

ssh connect error

buffer_get_ret: trying to get more bytes 4 than in buffer 0
buffer_get_int: buffer error

Seems to have something to do with the public key.
It helps to remove ~/.ssh/id_dsa* (or the whole ~/.ssh directory if you want to be sure).

This appeared to me only after the upgrade to Ubuntu Jaunty, I don't know if it's related or what the correct fix is.

There seems to be a matching bug report here.

Update: Apparently it's fixed by now.

Tuesday, February 10, 2009

Stuttering sound after upgrade to Ubuntu 9.04 (Jaunty)

It turns out that some sound drivers don't work well with PulseAudio, especially regarding the "glitch-free mode". The fix (as described here) is to disable glitch-free:


load-module module-hal-detect tsched=0

Afterwards, restart PulseAudio (or simply reboot).

Sunday, February 8, 2009

colorgcc from within SCons error: uninitialized value

Eror: Use of uninitialized value $ENV{"HOME"} in concatenation (.) or string at /usr/local/bin/g++ line 211.

Solution, see here:


$configFile = $ENV{"HOME"} . "/.colorgccrc";


my($found_HOME) = 0;
while (my ($key, $value) = each (%ENV))
if ($key =~ /HOME/)
$found_HOME = 1;

if ($found_HOME == 0)
$ENV{"HOME"} = "/";
$configFile = $ENV{"HOME"} . "/.colorgccrc";