Up until very recently I had never heard of Dtrace.
Sun Microsystems, makers of brilliant software but not money, created Dtrace for their Solaris OS. It allows you to create probes and listen on a port where syscalls or other OS events are reported.
This is awesome and also ported over to Mac OS X. This set of one-liners gives a small example of what's possible. If you're on a mac or FreeBSD or Solaris (!) and looking for a good time try running a few of these.
And if you have Instruments installed, you can launch apps and monitor their calls, file I/O, memory leakage, etc...
For my own personal Rube Goldberg machine, I might write a Dtrace script which listens for whenever files of a certain type are opened, and pipe them to a script which automatically backs them up using some version control.
Or similarly, automating other tasks such as running make whenever code files are written.
I was excited to learn about and had never heard of Dtrace, so I thought I'd share, enjoy!