Adam Sampson's web pages: Code Code Here's stuff that I've written and made available as free software. It should all run on pretty much anything that'll provide a POSIXish environment; most of it was developed on Linux, AmigaOS (with ADE) or FreeBSD. Useful code Code in this section is generally finished and stable; if it doesn't work, I'd like to know about it. GNU xhippo 3.2. A generic GTK-based playlist manager for Unix-like systems; it's been reported to work on Linux, FreeBSD, NetBSD and IRIX. It's capable of driving most command-line players (for instance, mpg123, xmp, timidity or ogg123). It supports XMMS-style playlists, recursive playlist inclusion, interactive playlist editing, GNOME drag-and-drop, and a variety of other interesting features. You might like to look at xhippo's page on gnu.org or a screenshot of xhippo in action. I announce new versions of xhippo on Freshmeat. gselt, a GTK program which watches the X selection and displays a configurable menu of things you can do with it (for instance, if you select a URL, it would list "Open in lynx", "Download with wget" etc.), matching selections to actions using regular expressions. htmltoprc, a suite of small programs to convert HTML files to PalmOS-readable doc files. (My preferred reader is CSpotRun.) The convertor works well on most input files; Wired back-issues, for instance, convert very well indeed. Needs Python 1.5 or above. ARNIE, a Markov chain conversational tool for the PalmPilot. (People who know me may have come across other implementations I've done of the same thing; my IRC bot uses the same system. The archive also includes a couple of tiny Perl implementations which the denizens of the FWP mailing list came up with.) A reasonable example of how to write a primarily-text-based application for PalmOS; also makes use of the Palm's database facilities to store the dictionary. itsmailbox.py, a Python program which converts ITS mailbox files (such as those found in the ITS source code documentation at nocrew.org) into mbox files, coping with a number of different date and message formats. linuxlogger, a minimal replacement for syslogd and klogd that works with Dan Bernstein's service management and logging systems---or my freedt below. mkservice, a shell script to create a service directory for daemontools. (This is included in freedt.) freedt is a clone of Dan Bernstein's daemontools under the GPL, sharing no code with the original implementation. It currently includes argv0, envdir, envuidgid, setlock, setuidgid, softlimit, supervise, svc, svok, svscan, svstat and recordio; still left to clone are multilog, tai64n and tai64nlocal. It also includes dumblog (a largely feature-free multilog replacement), mkservice (a script for automatically creating service directories), anonidentd (an identd implementation) and ratelimit (a bandwidth-limiting filter along the lines of recordio). It's stable enough that I'm using it instead of the original on my machine, but it still needs other people to look at it and test it before I'd recommend using it for real work. If you're using this, you will probably also want onenetd from below (which used to be included in this package as servetcp). logtailer, a small program that's capable of following multiple logfiles. Handy if you're running a number of daemontools daemons (or even Apache and syslog) and want to keep an eye on their logs. If you're looking for a somewhat more graphical tool that does the same thing, have a look at Paul Mutton's JLogTailer. element, a small tool for secondary-school chemists, which provides various information about elements in the Periodic Table. This was my first project under Linux, and therefore has great sentimental value to me. mod2text2mod, a pair of tools which convert Protracker modules to and from a human-readable format. With this package, you can use Emacs as a tracker. cpm, a patched version of the cpm-0.2 CP/M emulator for Linux (available on ibiblio). This version will build and work correctly on modern ELF systems, and also features a couple of fixes in the BDOS emulation. I was unable to contact either the original author or the author of cpm-0.21, another ELF-compatible version (which doesn't include the BDOS bugfixes); if you know where I might be able to contact them, please let me know. Most command-line CP/M programs will run happily on this emulator; for instance, I use it to run Hitec C for Zen development. z80em, a generic emulator for the Z80 CPU; an extended version of that included in the CHAOS source code. It's easy to modify, being based on the xz80 emulator core, and supports abstract console, serial and disk emulation. It's currently the only platform upon which Zen can be used. Convolve, my entry for the International Obfuscated C Code Contest; a tool to perform matrix convolutions on PPM images. This does not represent my normal coding style. webget, a suite of tools to allow offline web browsing. Mail me if you need to know how to install it. Needs Python 1.5 or above. This isn't Jasper Jongmans' webget, nor is it derived from it (or vica versa), although it bears some remarkable similarities. I guess there are only so many things you can call a download manager. cdsuite is a suite of small tools to make converting CDs to MP3, Ogg Vorbis or WAV audio files easy; it supports downloading track titles from FreeDB. vdesk is a virtual desktop manager to work with window managers that don't natively support them; I use it with aewm. Compile and install it with xmkmf -a; make; make install; invoke it as vdesk <desktop number> to switch to a desktop, or vdesk <desktop number> <window id> ... to move windows to a desktop, where desktop 0 means that the window should be made sticky. It works nicely with speckeysd. tart is a frontend for tar, gzip etc. which makes handling multiple archives in different formats relatively straightforward; tart t <files> will list the contents of the given files, and tart x will extract them. tart copes with tar archives in gzip, bzip2 and compress format, and could easily be extended to cope with other compressors and archivers. I have t and x aliased to tart t and tart x in bash. mosmon is a MOSIX load monitor applet for the ROX panel. carol is a brute-force Countdown number puzzle solver; on my 450Mhz K6-2, it'll search the entire problem space in 1.6 seconds. Combined with "ag", this takes all the fun out of watching the programme on TV. It can now list all solutions, list solutions falling in a certain range, and permit or forbid non-integer division results. sallows, a little tool for generating Sallows pangrams by using Robinson's random technique. amicon, a tool to convert Amiga old-style icons and NewIcons to PPM or XPM format, preserving transparency and palette information. Handy if you like the old MagicWB or ICONZ.A icons and want to use them on your X desktop. newsstats, a simple newsgroup statistics script. FiveGeeks and FiveGeeks24, Galeon spinner versions of the FiveGeeks logo in two different sizes. list-people, a tool which will list the people who've posted to a given newsgroup, and can maintain a list to identify new posters. This was built to make it easier to automatically send "welcome" messages to new posters on an internal newsgroup. phys, an SDL-based executive toy which simulates a group of balls tied together with bungee cords. Pyggle, a Python OpenGiggle client and server. onenetd, a modified version of servetcp from freedt that supports refusing clients with a predetermined message (and is built with automake). packcd, a tool for packing files to a set of CDs, either in order, or in a reasonably space-efficient way. Experimental code Warning: code in this section is likely to include little or no documentation, and will probably be difficult to compile. fith, a FORTH-like programming language designed for small systems and compilable with a Small C compiler. CHAOS. A minimal operating system for Z80 computers. This package includes a cross-development suite that runs under Linux; you will need the "asl" cross-assembler to compile it (available from ibiblio or whatever sunsite.unc.edu is calling itself these days). The OS and filesystem will fit in 8K of battery-backed-up RAM. Zen, a somewhat better Z80 operating system written in C, providing a small Unix-like filesystem and system calls which resemble the C standard library (fopen etc.). It runs under the z80em emulator; it hasn't yet been ported to any real hardware. It uses the Hitec C compiler running under the cpm CP/M emulator to compile. If you've got z80em installed, you should be able to use the OS image included in this archive to at least see what Zen looks like; recompiling it would probably be somewhat more complex. MyCPU, an emulator (in C) and assembler (in Python) for a four-instruction virtual processor which I designed with a somewhat esoteric instruction set. Some example assembly code is included. yesnomaybe.bf, a three-way coin toss implemented in Befunge for the sheer hell of it. z80calc, a FORTH-like calculator implemented in Z80 assembler, based on large chunks of the Small C+ maths library. I did at one point have a pocket Z80 machine successfully running this; it should be relatively straightforward to port to different hardware, as it already includes drivers for the pocket80 and z80em. gpenguin, a GTK program which displays a penguin logo and some basic information about your machine under Linux. hippo, an aborted attempt to rewrite xhippo in C++, supporting multiple interfaces. The code might be useful as an example of how to support GTK, Lesstif and text interfaces in one program, but it's not terribly useful as a music player. nanotcp, a misnamed miniature IP stack that will speak SLIP and respond to ICMP ECHO REQUESTs. It doesn't yet do UDP or TCP. superterm, an experimental terminal emulator written using Python and curses. Ended up being too slow to be of any use. PyICQ, an implementation of the Corporate ICQ protocol in Python. What's there works, mostly, but it doesn't yet support sending messages except via the server or most of the inter-client protocols, and the interface is very primitive. xlnt, a port of the Linux kernel console code to userspace. It needs some work on cursor handling and scrolling to be useful. funk, my hacked-up MP3 streaming system (including a server, command-line and CGI control interfaces, distributed song collection, and an IRC bot). Read the README file, and preferably the code; it's not very well documented or engineered. IRCClient class for Python, which implements most of the functionality you need to build an IRC bot. It also includes a couple of sample bots written using it. kitchenclock, a suite of tools to turn a PalmOS machine into a serial-controllable graphics display. (We planned to use an old Palm Pro as a clock for our kitchen, hence the name.) classtricks, a couple of nifty-but-not-useful Python classes. OutputWriter wraps a file object and lets you print to it using a C++-style << operator; Internet represents the Internet, so you can say Internet().org.slashdot["tcp"][80] to open a socket to Slashdot's webserver. newsarchive, a script that, when run nightly, will maintain an mbox archive of all the newsgroups on a leafnode server. nibbles.sh, an implementation of the popular "nibbles" game (what Nokia call "Snake", I believe) in Bash shell script. occlife, a one-process-per-cell implementation of Life in occam. Compiled with KRoC, this runs at about two frames per second on a 140x140 grid (i.e. 19,600 processes) on my machine. Screenshot showing the R pentomino a few hundred generations down the line. subtle, an experiment in reading DVD subtitles through gocr. Doesn't currently detect subtitle lengths. Other projects I've contributed to aewm: MWM hints support, Xft font rendering, nested menu support (merged). dillo: "force my colours" (merged). uwm: initial 3D borders support (merged). gkrellm: MH folder checking (merged). XFCE: made the mail icon on the panel show whether you have mail or not (merged). XawTV: plaintext support for alevtd (merged). leafnode: "nopost" option to prevent posting to a particular server (diff against 1.9.18). rxvt: MWM borderless support, override-redirect support, arbitrary command on bell, fixed buffer overflow in command.c (from Debian patch) (diff against 2.7.8). clock: fix for reading insufficient data from the child, fix for not stripping the LF from the message (diff against current version). speckeysd: avoid collecting zombies (diff against current version). xcopilot: don't rely on Linux mmap semantics, and thus compile correctly under FreeBSD (diff against 0.6.6). Why does this page look odd? Adam's web pages Home Code Ideas azzlinux Electricity Ad filter Shell tips Browsers Software I use Licensing CV Links Contact Adam Sampson <azz@gnu.org>