Skip to navigation

Archive for January, 2009

Adding an “X-label” header to lots of messages at once using mutt

Thursday, January 22nd, 2009

I’m using this method to add labels to individual messages in mutt. (You can use the X-label header in a similar way that you label e-mail in Gmail. You can search for messages with a certain label using the ~y pattern in mutt). But what if you suddenly want to apply a label to lots […]

Filename pattern matching via bash extended globbing and find regular expressions in shell scripts

Tuesday, January 20th, 2009

I was confused that bash would expand some patterns nicely to match filenames when I was on the commandline, but the same pattern would not work from inside a shell script. For example, the following pattern would nicely match all files in the current directory not having an “Rnw” or “tex” extension on the commandline: […]

Removing duplicate lines from a file

Wednesday, January 14th, 2009

Case-insensitive: { rm “$file” && awk ‘!x[tolower($1)]++’ > “$file”; } < "$file" Case-sensitive: { rm "$file" && awk '!x[$1]++' > “$file”; } < "$file" Here's a shell script you could use, as it stands, only works for one file at a time: #!/bin/bash usage() { cat "$filename"; } < "$filename" else { rm "$filename" && […]

Edimax EW-7318USg and switch to wicd

Sunday, January 11th, 2009

I’ve just bought the Edimax EW-7318USg wireless USB dongle, mainly to use it in corners of the house where the wireless signal is weak. It works fine and does seem to boost the signal. With network-manager, I found no way to quickly switch between the built-in wireless card and the Edimax. I installed wicd, which […]

Running X apps (like zenity) from crontab (solving “cannot open display” problem)

Friday, January 2nd, 2009

I’ve written a small script that checks whether I have queued mail and that displays a notification icon via “zenity –notification” in case I do. I wanted to run it using ~/.crontab but it wouldn’t run. First, I got error messages from the cron daemon that looked like this: (zenity:22981): Gtk-WARNING **: cannot open display: […]