This directory is full of various small hacks I've done that are interesting or
otherwise worth preserving. All of these are written in C because C is my mother
An obfuscated program that I've forgotten the original purpose of. Who knows
what it was intended to do?
A demonstration of polymorphism via boxing.
A demonstration of the perils of preprocessor abuse, making C read a lot
like... well, like another language.
A curses-based visual editor. Arrow keys for movement, C-x to enter a
command; commands are:
f(ind text) q(uit) r(ead file) s(set) w(rite file) w(rite then )q(uit).
Commands are first read from $HOME/.ed3rc on startup.
Exceptions in C, inspired by plan 9's C error handling mechanism.
The exception stack is a stack of jmp_buf (see setjmp(3)), throw is a longjmp
to the top of that stack, catch is a setjmp. The poperror function serves to
clean up a catch frame. Note that this doesn't work as-is because catch saves
the wrong stack frame!
Injects a thread running the shellcode at the end of the payload into another
process. Requires ptrace() access. Change the 0xf00 at 'make me 0x10f00' to
0x10f00 and we'll be inside the same thread group. The basic approach: land
stage1 shellcode at the usual ELF entry point (unlikely to be running right
now) which maps us some memory in the target, trap back to us via a magic
syscall, drop stage2 shellcode into that mapped memory, clean up after
stage1, transfer control to stage2; stage2 spawns a new thread then puts
everything back on the old target thread.
A machine-language ptrace-based debugger with a terse interface. Do '?' for a
list of commands. Must be invoked with a target pid - it cannot launch
targets itself at the moment. Can read & write memory and registers and
single-step the target, but doesn't know how to set breakpoints (although you
can do so yourself using '!' with 0xcc).
A maze generator ("rooms generator" in the parlance of 2010 me). Emits a
randomly-generated maze on stdout when run.
A minimal implementation of sort(1) - sorts stdin lexicographically to
A self-contained CGI wiki in C.