[ Content | Sidebar ]

Archives for programming

Syncing SanDisk/GMPC cover art

Do you have a SanDisk MP3 player? Do you use GMPC? Do you read this blog? I suspect that set is very small but if you are in this demographic here is a treat for you: a Ruby script to copy the cover art downloaded by GMPC onto your SanDisk device. Here it is: sandisk-cover-sync.rb […]

Some thoughts on trees

I’ve been wondering for a while now what is the best way to add trees to Train Game. Trees seem fairly important for a train game seeing as trains mostly travel through the countryside where there are trees. (Except for my daily commute to work through Slough where there are no green things.) Anyway my […]

Valentine’s day

Today is Valentine’s day. Valentine’s day is all about love, and the internationally recognised symbol of love is the stylised heart. I love sed. This is probably why I spent this evening alone writing a filter to format text as ASCII hearts: nick@pickle:~$ sed –posix -n -f hearts.sed < poem Shall I comp are thee […]

Adding similar songs from LastFM to your MPD queue

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. […]

Updated Ruby BibTeX parser

I’ve updated my Ruby BibTeX parser as the version on this site was quite old and a number of people had sent patches and other suggestions. The latest version: rbib-0.2.tar.gz

**MECHANICAL PIG**

Important news! We have successfully simulated a mechanical pig! This breakthrough has been accomplished by the ingenious combination of the PIG INTERFACE LANGUAGE and the PIG CONTROL LANGUAGE. Sample program: PIG DIVISION GRUNT OINK GOTO MUD PIGNAP MUD DIVISION ROLL ROLL ROLL GOTO TRUFFLES PIGNAP TRUFFLES DIVISION EAT EAT EAT GOTO PIG PIGNAP Sample run: […]

PowerShell and Git living in harmony

I’m porting some of my programs to Windows at the moment in the hopes of getting access to a bigger market. Turns out that git actually works quite nicely in MS PowerShell. How lovely!

A gettext i18n tutorial

I’ve recently struggled with GNU gettext for internationalizing some of my programs. This, for the benefit of other people who, like me, can’t be bovered to read the documentation, is the method I’ve used successfully: I’m assuming you have a standard GNU autoconf/automake setup. If you don’t, there’s a lot of manual work to do. […]

Meta-Ruby for the win!

So… let’s suppose you’re hacking away in Ruby and you mistype a method name: irb(main):001:0> 5.clas NoMethodError: undefined method `clas’ for 5:Fixnum from (irb):1 Obviously I *meant* to type ‘class’, but I got the arity (0) right and the spelling wrong. I propose an extension to Ruby based on the hypothesis that typos are more […]

Cakesniffing on Rails

A Web 2.0 application for cakesniffers everywhere: cakesniffer-or-not.