Sweet Hacks – Vol I
A sweet hack can be a clever piece of code, an innovative way of solving a technical problem, or just a cool use of technology. I put together a list of 5 hacks that I think are really sweet.
I am making Sweet Hacks a regular series here at GrokCode, turning it into a blog carnival that runs every three months. If you would like to nominate your own sweet hack for the next issue, send an email to jess [AT] grokcode.com with a short description of the hack and a link. Or if you are a del.icio.us user, tag the page “for:grokcode” to put it into my “links for you section.”
- Shamus Young shows us how to create random cartoon-like faces in PHP. It works by using the GD library to fill an image with a random hue for the background, then randomly chooses and inserts a face shape, eyes, mouth, and other facial features into the image. Here is the full description of the image creation process. The resulting images are used to create avatars used in the WordPress Wavatars plugin.
- Next up is codepad by Steven Hazel which allows you to paste code in 10 different languages including C, Perl, Ruby, and Scheme. Codepad then compiles and executes your code under ptrace in a chroot jail inside a virtual machine. Steven also describes how he was able to scale codepad after a 1000x increase in traffic on his blog hackerdashery.
- Ever had to hack something together that ran faster than grep? James Hicks has. And he lived to tell about it on his blog isnerd.net. James uses some interesting properties of the data he is matching to write a lighting fast matching program in C.
- Last up is a shameless plug for my Joke Generator written in Common Lisp. You seed it with a vocabulary and it tries to use this knowledge to create jokes of the form “What do you get when you cross X with Y.” Hilarity ensues! Although sometimes its more the “What?!?” kind of hilarity than the ha ha kind.
Well thats it for this installment of Sweet Hacks. Don’t forget to let me know about your own hacks.