[ Content | Sidebar ]

Archives for programming

Cute objcopy hack

I learned a useful trick today for embedding arbitrary data in an ELF executable. This is an easy way bundle RAM disks and other resources when you’re running on bare hardware. The first step is to turn our binary data into an ELF object file: echo yahyahyah > yah objcopy -I binary -O elf32-i386 -B […]

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


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!

Ruby Toys

UPDATE 6/4/15: this post was previously a page but was removed when I reorganised the sidebar. Check out the rbib project on GitHub. This page contains a couple of small Ruby utilities I’ve written. BibTeX parser A parser for BibTeX databases. Mostly intended for transforming the entries in some way, such as deleting unneeded keys. […]

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