by Fredrik Roubert

During the years, I've written quite a few lines of source code. On this page, I've tried to collect those tools and library functions that could be of interest and use to others. Some of it is old and some of it is poorly written, but everything solves a problem that I once had, and maybe it can help someone else to solve their problems in the future. I give away the source code on this webpage freely. Do whatever you like with it, no strings attached, no guarantees given. But if you find something useful, I'd be happy to hear your comments about it, and if you make improvements to any of my programs, then I'd really appreciate if you shared those improvements with me. All C source should compile and run on any POSIX compliant operating system, unless otherwise stated.


The dc1000 program, that controls Panasonic digital cameras, has its own webpage.
A tool to import a MediaWiki XML dump into Google Sites.

A drop-in replacement for InputStreamReader, that is able to automatically detect which one of a list of character encodings the input is using. It works by first reading to end-of-file and then testing if the input is valid for a certain encoding. The first possible encoding is chosen.
A Perl module with functions to read and write comments in GIF files. It also contains a full GIF file format parser (but no functions to decode or encode image data).
A Perl module with functions to read and write JPEG meta data, like COM (comments), APP12 (information from some Olympus digital cameras) and Exif (information from digital cameras). It also contains a full JPEG file format parser (but no functions to decode or encode image data).
An implementation of an algorithm for finding differences between strings. The implementation uses wide characters (wchar_t) and should compile on all modern C implementations. This code was initially written to highlight spelling errors, but can have other uses as well.


[PATCH] fix magic sysrq on strange keyboards
Some keyboards send the make and break codes immediately after another when the SysRq key is pressed, and this behaviour makes it impossible to use the Linux Magic SysRq Key feature. I've written a patch to the Linux kernel to work around this problem. The patch was posted to the Linux-Kernel mailing list, became included in the 2.6.17-rc4-mm2 kernel release, and was accepted into the mainline kernel on 26 June 2006.
A sample Linux kernel module that creates a device named /dev/hellodev that returns the string Hello, world! when being read from. Nice as an example, but probably not useful for anything else.
Some old libraries written in the Simula programming language, and some outdated information about the language itself.


A very simple assembler for the Am2910 microcontroller. An example input file is available here: labb6.asm
Use iconv to automatically convert file names between different character encodings. Recurses into directories.
A tool to be used together with the Microsoft Visual C++ compiler and NMake. It parses the compiler output to find dependencies between source files. It can also search directories for source files matching a shell pattern. All output is presented in a format suitable for direct inclusion in makefiles.
Create sparse files (containing only null characters) of arbitrary length. Also useful for creating files of zero length with specified file permissions.
Recursively download image galleries from
A wrapper around ssh to conveniently execute lpr on a remote machine, using documents on the local machine as input.
A quick hack that enables a user to take ownership of any file in a directory where the user has write permissions.
Send ENQ (0x05) to the terminal, and print the returned string to stdout. Useful for identifying different terminals from shell scripts.
Truncate a file to specified length.
An alternative implementation of the classic who program. This one prints all users' full names, and lists which remote hosts they are connected from.
Prints out all font paths that the X server is currently configured to use.

Fredrik Roubert <>