Robbert Haarman



This page is where I link to software that I have written and wish to share with the world. It ranges from simple scripts to full web servers. If no license is included, the software is in the public domain and you can do whatever you feel like with it. I hope you find some of my code useful!

As a friend of mine once remarked, open-source developers tend to stop at the point a project becomes almost usable. I suffer from the same disease, so many things provided here come without documentation, and you may need to read through the source (or contact me) to figure out how they work. Same applies to configuration, Use the source, Luke!

Ruby Programs


Ahoy is an efficient, decentralized service discovery protocol, designed for mobile ad-hoc networks (MANETs). Based on attenuated Bloom filters, it has a low impact on the network and allows services up to a configurable distance (measured in hops) to be discovered. The protocol is described in full detail in the report Ahoy: A Proximity-Based Discovery Protocol. The report and implementation where developed as part of my Master of Science work at the University of Twente.


mailvisa is a bayesian spam filter, inspired by Paul Graham's A Plan For Spam. It is mainly intended for my own expirimentation, but provided here for those who are interested. It is competitive with other bayesian filters in terms of accuracy and speed. The system is written in Ruby.

Python Programs


StreamDist is a technology that allows serving streams to an arbitrary number of clients using fixed bandwidth. This is achieved by sending the data to the first client, who then sends it to the second client, etc. The distribution offered here contains a number of Python scripts, licensed under the GNU GPL. Download streamdist-20040320.tar.bz2 (14 KB).


Before the hard drive in my tower died, I had the dream to mount it's filesystem from my laptop and have the files on both systems automagically synchronized while also having access to some of them when not connected to the tower. Well, it turned out that none of the existing networked filesystems (I looked at NFS, Coda, InterMezzo and SFS, but none of them worked for me. I decided it couldn't be that hard and decided to write my own.

netfs is a very simple (currently read-only, public access without authentication) protocol for accessing remote files. The distribution here contains a Python module and a C library for developing clients and servers, a server in Python, and a utility that downloads one file (both Python and C versions available). I am currently working on kernel modules for Linux and NetBSD.

You can get the distribution here: netfs-20040309.tar.bz2 (6872 bytes).


IRC is ancient, but its open and extensible architecture has allowed it to withstand the test of time, and it remains a chat protocol of choice today. One thing I don't see on many IRC servers is presence notification the way instant messaging protocols do it. Sure, IRC allows one to query which users are online through the ISON command, but this is awkward and requires contact lists to be kept client side.

BuddyBot is a service that notifies users when their buddies sign on or off, bringing IRC's capabilities on par with current instant messaging protocols. It's currently in alpha stage and has known bugs and deficiencies, but is offered for download nonetheless: buddybot-20031128.tar.bz2. It's licensed under the GNU GPL.

Perl Programs


keyretriever is a Perl CGI script intended to allow for the secure storage and retrieval of SSH keys (or any other files, really). Instead of storing the keys in a file (which anyone might access), the keys are stored in the script itself, and only sent after the right password has been entered.


Logalize is a Perl script that analyses Apache logfiles (in combined format) and presents some statistics. The statistics are rendered as bar graphs in pure XHTML and CSS, viewable with any web browser. The statistics are generated from the logfile each time the script is run.


Perlcookies is a software package for displaying randomly selected text messages (fortune cookies). The cookies are stored in a format compatible with the traditional Unix fortune command.


wake is a Perl program to send Wake-on-LAN packets to wake up remote systems. It works on any system that has Perl installed and supports UDP; any Unix-like system and even Microsoft Windows should work

mailforum is a simple scripts that parses an email message and inserts it into an MySQL database (which can serve as the backend to a weblog). Messages must have a subject line in the format (num) title, where num is the number of the message that is being replied to, and title is the title of the comment to be posted. The body of the email is copied verbatim into the comment body.

Get the source here: mailforum-20040127.tar.bz2 (1330 bytes). You must edit the script to suit your needs.

Image Indexer

Inspired by a friend who hacked up a DirectoryIndex plugin for Apache, I decided to write something similar. Image indexer is a small perl script that generates thumbnails for all JPEG, PNG and GIF images in a directory and displays them before their filenames in a directory listing. Like the shell, it hides filenames starting in `.'. It requires ImageMagick's convert to generate the thumbnails (if you generate them by hand and put them in the .tn directory, you'll never need convert.

You can download the script (sorry, no documentation yet): imageindexer-0.1.0.tar.gz Installation is as simple as unpacking the archive, then copying (or symlinking) the script in every directory you wish to have indexed. The thumbnails are automatically generated on first run. Be aware that this requires the script to have write access to the .tn/ directory!


W runs the w command, then formats its output as XHTML 1.1. Get it here: w.tar.gz.


mailconv converts a mailbox from one format to another. It supports mbox, MH and maildir. Mailbox formats are autodetected wherever possible. Download mailconv-1.0.0.tar.gz.

PHP Scripts

This paragraph used to say that PHP is my favorite language for generating web pages. I have since learned a lot about programming language, and I now think PHP is pretty badly designed. It is useful for generating web pages, but once you start to write more application logic in it, it starts to hurt. Consequently, PHP is not one of my favorites anymore. Still, I have done a lot of work with it. For example, this site is written almost entirely in PHP. Below is some PHP code I have released to the general public.

I have put a number of useful functions together in a file I named These functions do things like generating the whole header for an HTML document, generate heads for sections and subsections, generating abbreviations and acronyms that display their expansion when moused over, and taking care of footnotes.

You can download the file in gziped format: As always, for configuration, use the source, Luke!

C Programs

OK, I said that C is Wrong, but that doesn't mean I don't code in it. :-) So, without further ado, behold my collection of C programs!


cconstants is a library and a set of command line utilities that allow the values of constants defined in C header files to be queried outside the C preprocessor. This allows the values of these constants to be queried from programming languages other than C, on systems without the C preprocessor installed, and on systems where the header files defining these constants are not available.


chrootexec allows normal users to run commands in chroot jails.


detach forks a new process, detaches it from the terminal, and executes a given command in it. This can be used for starting processes that don't terminate when the controlling terminal does.


mhttpd (Multi-user HTTP Daemon) is a webserver that keeps individual sites isolated from one another by running each one under its own user and group. This means that scripts on one site cannot access files on another site, solving many of the security risks typical to shared hosting. A secondary goal in the design of mhttpd was performance. The server avoids forking and even function calls, and does not implement some parts of the CGIstandard, and various features can be disabled at compile time. Unfortunately, the code is horribly ugly, so ugly that I thought it wiser to start over. mhttpd is now deprecated in favor of muhttpd, which focuses on cleanliness and simplicity. mhttpd is still offered for download to those who wish to experiment with its unique architecture.


muhttpd (mu HTTP deamon) is a simple but complete web server written in portable ANSI C. It supports static pages, CGI scripts, MIME type based handlers, and HTTPS. It drops privileges before accepting any connections, and it can log received requests. It has been tested on GNU/Linux, NetBSD, FreeBSD, Mac OS X, and Cygwin. It runs successfully on 32 bits and 64 bits, little endian and big endian systems.

RTL 8180 Driver

This is the driver for the RealTek 8180 wlan chipset used by some (cheap) 802.11b cards. I have been working on getting it to work with Linux 2.6, but without success so far (it gives me a kernel oops due to a null-pointer dereference when loaded).

This driver is now obsolete. A fully open-source (and working) driver is available from the rtl8180-sa2400 project. (thanks to bsammon for the link). My old (not working) sources are still available: rtl8180_2.6-1.5.tar.gz (239 KB).


TurboVM is a small and simple virtual machine, intended as a compilation target for programming languages. TurboVM uses bytecode with a RISC instruction set designed for easy and fast generation and interpretation, as well as flexibility (i.e. it does not impose a certain paradigm like many other VMs). Bytecode can be interpreted or compiled to native code (currently via C). Some speed tests indicate that the bytecode interpreter runs about a factor 15 to 30 slower than native programs, whereas compiling the bytecode yields performance equal to or close to that of equivalent programs written in C.

C Libraries


Alchemist is a code generation library that can be used to programmatically generate machine code. An example scenario in which this can be useful is in the implementation of programming language interpreters. The user types an expression, which is then compiled to machine code and subsequently evaluated.


CStuff is a collection of code snippets that will hopefully ease the life of C programmers. They can be dropped into your programs by themselves or be compiled into a library which you can then link against. So next time you find yourself needing a hash function, a pseudo-random number generator, a common data structure, or one of the other zillion things that C programmers end up implementing over and over again, take a look at CStuff. Perhaps it contains something you can use.


libagc is a garbage collector. It can be extended by registering new types at runtime, and allows finalizers to be specified. This makes libagc flexible and powerful. It's written in ANSI C, and should thus be very portable.


libioport is an I/O abstraction layer, named after the I/O abstraction used in Common Lisp and Scheme systems. It provides an abstract data type called an I/O port, on which input and output can be performed. The functions for operating on these ports are independent of the type of object that I/O is performed on. At the time of writing, libioport can perform I/O on stdio streams, strings and Unix file descriptors.

The Deadbeef Random Number Generator

The deadbeef random number generator is a simple pseudorandom number generator (PRNG) that generates 32-bit pseudorandom numbers, with heavy use of the constant 0xdeadbeef. It's simple enough that one can learn the code by heart, and implement it whenever a simple PRNG is needed. The generator is fast and does well on a number of tests I've put it through, but I make no claims about the suitability of the generated numbers for any purpose. Results of analysis and suggestions for improvement are welcome.



LOAD (Lisp On A Diskette) is a bootable Scheme implementation that fits on a regular 1.44 MB diskette. The current distribution uses TinyScheme on top of the Linux kernel.

Miscellaneous Programs

This page contains various small programs I have written. Most of them do things related to backups or email. They are placed in the public domain or provided under liberal licenses in the hope that they will be useful to others. Feel free to adapt and use them for your own needs.