pm-utils and Locked Screens

April 06, 2010 at 05:54 AM | categories: tips, archlinux | View Comments

pm-utils seems to be the clear winner to userspace suspend and hibernate setup. It's a great back, but, for those of us who don't run a desktop environment with a power manager, there's one thing missing: screen locking. I'd like the screen to be locked when my computer resumes from either suspend or hibernate, and I don't want to run gnome-power-manager to get that functionality. So, 00lock-screen to the rescue. Just drop that file in /etc/pm/sleep.d and, as long as you have xscreensaver, gnome-screensaver, i3lock, or xlock setup, the screen will lock as your computer suspends or hibernates.

For the Archlinux users, it's already packaged in the AUR: pm-utils-screen-lock

OpenWRT on the D-Link DIR-615

March 10, 2010 at 06:41 AM | categories: tips | View Comments

Last night, I finally got around to installing the OpenWRT 10.03 Beta on my D-Link DIR-615. The short version: it works and works well. There were only two surprises I ran into.

The first surprise is that the wireless drivers are not included in the install image. Running opkg update; opkg install kmod-ath9k takes care of that. The drivers are left out by design at least on this router and the WRT160NL. Bonus points to OpenWRT for allowing me to file a bug without creating an account on their bug tracker.

The second surprise is that the dynamic dns client doesn't know about DNS-O-Matic. I installed the ddns-scripts package and used the following config to get it working:

config 'service' 'myddns'
    option 'ip_source' 'network'
    option 'ip_network' 'wan'
    option 'check_unit' 'minutes'
    option 'enabled' '1'
    option 'domain' ''
    option 'username' 'username'
    option 'password' 'password'
    option 'update_url' 'http://[USERNAME]:[PASSWORD][DOMAIN]&myip=[IP]'
    option 'check_interval' '5'
    option 'force_interval' '480'
    option 'force_unit' 'hours'

gdb and pthread

February 19, 2010 at 09:33 PM | categories: tips | View Comments

Error message translation time. Here's an error gdb gave me today:

[Thread debugging using libthread_db enabled]             
Cannot find new threads: generic error

Translation: Programs that use pthread functions should really be linked with the -lpthread option.

Scripting wireshark with lua

December 09, 2009 at 06:44 AM | categories: tips | View Comments

While attempting to wrap some wireshark processing with a bash script, I discovered that I didn't need to write complex bash code at all, because wireshark has a built-in scripting language. Even better, it's a common scripting language: lua. It looks like Debian and its derivatives ship wireshark with lua support, but for everything else, you'll have to rebuild the package to enable it. There's a great page of examples and the api is really simple. And for those cases where you don't want to use the wireshark GUI, lua scripts work just fine with tshark.

If lua is overkill for the task at hand, tshark also offers decent control over what shows up in the output. If you want to see all HTTP requests and their request URI and method, without any other information about the packet, this tshark command will do the trick:

tshark -T fields -e http.request.method -e http.request.uri -R 'http'

View a Certificate

May 20, 2009 at 11:10 AM | categories: tips | View Comments

Yet another command I'll never remember unless I write it down. Here's how to view a certificate. In my case I was viewing a certificate that Mutt had stored:

openssl x509 -in .mutt_certs -noout -text

Next Page ยป