Wednesday, February 24, 2010

Change underscores in filenames to dots on a whole directory

Change underscores in filenames to dots on a whole directory:

for i in *;do mv $i `echo $i | sed -e 's/_/./g'`; done

Friday, February 19, 2010

Simple SDL example in C++

This blog post has moved here

Tuesday, February 16, 2010

Find and delete

Someone didn't appreciate the existence of queueing systems like PBS and rolled their own queueing system that is supposed to take care of removing dead jobs from an app server. So I had to look for the old files that were causing the problem and see if I could delete them. Thankfully this is really easy with a simple find command.

 find ./ -type f -mtime +10 

Switching the -type to d will do the same for directories. Unfortunately there is no clever hack for beating people who do this kind of thing over the internet.

Saturday, February 13, 2010

n900 gnu screen in debian delete key doesn't work

See title. Seems to be a long standing bug in the upstream Debian package or something: https://bugs.maemo.org/show_bug.cgi?id=3071 . Here's my complete screenrc which also fixes a problem with the enter key in vim and changes the default escape key of screen from ctrl-A to ctrl-B put this in ~/.screenrc

bindkey -a -k fe stuff ^M
bindkey -d ^@ stuff ^?
escape ^Bb

Friday, February 5, 2010

CppUnit disable exception handing

By default C++ unit catches exceptions, this can make debugging a lot harder (as it often doesn't give you much information about the exception that was thrown or which line number it was thrown on). To disable the exception catching you need to remove the default protector:

// Normal test runner
CppUnit::TextUi::TestRunner runner;

// disable exceptions
runner.eventManager().popProtector();

Wednesday, February 3, 2010

Saving a process running in the foreground

From here:

http://nickloman.wordpress.com/2010/02/03/saving-a-process-running-in-the-foreground/

Basically:

ctrl-Z
bg
disown –h PID

neat!