November 30th, 2009
Here’s a cute hack which uses LastFM to find songs similar to the one currently playing in MPD and add them to your playlist: more-like-this.rb.
To use it just run
more-like-this while MPD is playing and 10 similar songs will be appended to the playlist. Give it a numeric argument to add a different number.
You’ll need a few Ruby gems for this to work:
gem install librmpd scrobbler
So, yes, I’ve finally switched from Amarok to MPD. Sadly after the greatness of Amarok 1.4, each new release takes giant backward steps in usability – at least for my use cases :(. GMPC is OK as a client, and I’m really liking the programability.
October 31st, 2009
Recently I had a flirtation with removing all the non-free software from my Debian installs. This didn’t last very long: I got annoyed that I couldn’t watch iplayer with gnash, and blodgett reminded me that I had a copy of Vista running in VirtualBox. Ooops.
However, upon reinstating the non-free repository I installed the vrms package to remind me of my failings. Blodgett suggested vrms might be better implemented as a popup character like clippy. But wait! Doesn’t xcowsay do something very similar?!
Well, xcowsay has a
--cow-size option that lets you select from small, medium, and large cow images. This actually just looks for a
cow_*.png file, so if we created a
Here we see Richard Stallman arising from the Humber like some terrible sea monster about to wreak destruction on the propriety software industry of Hull.
If you want to use this yourself just install xcowsay, vrms, and grab these files:
- cow_rms.png – save this in
/usr/share/xcowsay or wherever xcowsay is installed.
- vrms-xcowsay – a script to invoke xcowsay with the output of vrms. Don’t forget to
chmod +x it!
The script is very simple and looks like this:
(printf "I SEE UR USIN NON-FREE SOFTWARES :-(;\n\n"; vrms) \
| xcowsay --font=monospace --cow-size=rms $*
I’m thinking of adding a
--image option to xcowsay 1.2 to make things like this easier.
UPDATE: xcowsay 1.2 now supports this via the
September 19th, 2009
Earlier I posted a hack to get the Linux kernel to send synthetic key release events for the Fn-keys on a Samsung Q320. But I forgot about actually submitting the patch to the kernel developers until today. However, it looks like this hack will be unnecessary as of 2.6.32:
On Sep 19, 2009, at 12:20 AM, Nick Gasson wrote:
> This adds a workaround for the missing fn-key release
> events on Samsung Q320 and similar laptops.
> Tested extensively on my own laptop.
> Signed-off-by: Nick Gasson
Thank you very much for your patch, hovewer I will not be accepting any more patches for the force release quirk in the kernel. 2.6.32 will have ‘force_release’ sysfs attribute allowing to apply the quirk from userspace.
Which is good, because either way I won’t have to use a custom kernel. I wonder how long this will take to propagate to Debian though…
August 19th, 2009
I’ve been having a problem for a while with my Nokia 6300 phone not accepting the self-signed SSL certificate I use on my IMAP server (dovecot). This is a bit annoying because I can’t read emails on my phone.
Various Nokia forums suggest that you need to download the certificate over HTTP to install it. This is true, but there is an extra key step: the certificate needs to be in the DER format rather than PEM, which the phone doesn’t like. To convert, just use OpenSSL like this:
openssl x509 -in dovecot.pem -inform PEM -out dovecot.crt -outform DER
Place this somewhere you can access over HTTP and navigate to it using the phone. You’ll be asked if you want to save it, say yes and the certificate will be permanently installed in the phone. Now try accessing your mail over IMAPS and everything should work.
This trick should also work for other SSL applications (e.g. HTTPS), but I haven’t tried it.
July 12th, 2009
You know how GNOME/KDE have “shutdown” and “reboot” buttons that normal users can use to turn off the computer? Rather than using sudo or making
/sbin/shutdown setuid, they use HAL which provides a nice power management interface. Turns out this is pretty easy to call from the command line so you can use it in Fluxbox, etc.
The DBus object is
/org/freedesktop/Hal/devices/computer which has lots of interesting methods including
Suspend(). For example, you can reboot the computer using:
qdbus --system org.freedesktop.Hal /org/freedesktop/Hal/devices/computer \
This is using the
qdbus tool which is distributed with QT. If you get permission errors you may have to configure PolicyKit to let you call this interface. Here’s my PolicyKit.conf which works for me on Arch Linux. (You’ll also need to add your user to the
Here’s a simple script to wrap this up: hal-power. Usage example:
hal-power reboot to reboot the computer.
July 7th, 2009
Attention Web 2.0 fans! The MECHANICAL PIG is now Twitter-enabled! You can follow its progress here: http://twitter.com/MECHANICALPIG
More to follow!