Marginal Hacks

"I'm glad cavepeople didn't invent television, because they would have just sat around and watched talk shows all day instead of creating tools." - Dave James

LICENSE Is it Free?

Too see more/less tools, change minimum rating (0,3,4,5 stars): none | ****
-- Currently displaying code with 4 or more stars --

Name Rating Works? Description

Y Simple perl script for UNIX/Ubuntu/Debian systems to stream mp3/oggs to an AirPort Express Airtunes server. Requires Justeport (which requires mono to run the .NET exe)
Homepage Download Changelog album
Y An html photo album generator which descends directories and has theme support. For an example, see my photo album.
Homepage Download Changelog asq
Y Mame Cabinet front end, nice and simple and fast, using arcade controls. It runs in a terminal window but can display a screenshot window as well. Supports MAME as well as other emulators and various games.
Homepage Download Changelog bew
Y A webcrawler/robot for mirroring entire web sites or web trees. Just give it a URL and it gets everything underneath it. It can tell you about broken links as a helpful side-effect. If you want something more stable but don't need the recursion, see findex.
Y Bugzilla scraper. Can get list of bugs from a bugzilla server and output them in a user-definable format. Useful for regression scripts and the like, or anyone who wants command-line read access to bugzilla.
Y Converts multi-burst photos taken on a digital camera (such as my Sony DSC-L1) into animated gifs.
Homepage Download Changelog Contact.cgi
Y A CGI mailing form that can verify from email addresses without revealing your email, as I do at my Contact Page. Great for making a "Contact Me" page without worrying about people collecting your email. Also good for mailing lists and other websites that want to replace all their mailto: links. Themeable.
Y A simpler CGI mailing form that doesn't verify email addresses but can only send to a hardcoded destination. Themeable.
Homepage Download Davent
Y Themeable event registration system which I've developed/used for our dance weekend events for over a decade now. Includes website creation, registration, payment processing, door checkin and even post-event survey. Different events are created by creating small perl files of info, allowing things like complex date-based or # sold based pricing. The biggest weakness is in dealing with more complex checkin issues, such as dealing with one email buying multiple registrations and doing registration changes and trying to figure out the correct price (some of these problems are intractable).
Homepage Download Changelog DaVite
Y This is a web invitation system, much like or, but you have total control over it! Note: I am no longer developing DaVite, as I have started to do work on MyVite
Homepage Download Changelog ePerl
Y Embed perl in your text files! This is a very snifty tool. It was originally written by Ralf S. Engelschall as a C program, and I realized that it should be written in perl, which I did in a program that is an order of magnitude smaller. (In fact, the source for this page is eperl).
Y This script kicks ass for code development. Watches a file and runs it (or something else) every time it changes. Write your code in one window, and watch it automatically execute in another.
Y An LD_PRELOAD tool that can give you a log of all the exec's done by a command and any of it's children. Useful for debugging wrappers that call wrappers that call wrappers... Also traces stdout/stderr file redirects as well as environment variable settings.
Homepage Download File_Browser.cgi
Y This is my file/database browser in a cgi script. It has a similar look as the old Windows file browser except that it can keep track of open folders inside closed folders. You can see it in action at the Fringe.
Y Efficiently finds all duplicate files in a file list and optionally removes them. Now (v2.00) with massive speedups for large sets of large files. Ran on 16Gb of 3900 files: old find_dup: 12 minutes, new find_dup: 3 minutes.
Y Fetches an index of files. Can count through numbered URLs and only grab specific types of files, etc.. Pretty darn useful for scrubbing links out of pages. Like a non-recursive but more stable version of bew. See options/usage for many ways to grab many URLs.
N Finds/copies the hidden/deleted flash cache files that chrome (and firefox?) now store with the flash plugin, such as youtube and google videos (can find other such deleted cache files as well). UPDATE 2012/05: Seems that youtube has changed their ways and this no longer works, but I've updated myfilm which should be working again. If you have any information on how Youtube is caching their files, I'd love to hear it.
Y Creates CGI form/registration code. You describe the form inputs, and it creates the code for outputting, checking and correcting. It's pretty damn useful if you ever need to write some forms. You can look at the script directory, or else grab the tar.gz
Y Forge email. Can handle port 25 and sendmail method. If you use it by itself and don't have access to an insecure port 25, then your mail may have the "may be forged" messages. You can fix this by either downloading the suid version or, much safer, downloading the additional forge_pipe tool which forge can use for you and then:
chown root:root forge_pipe ; chmod 4755 forge_pipe
I don't guarantee that it's safe as suid!
Y A command-line interface to google calendar using ruby. It can also add Facebook events, extracting the event code from the Facebook page. A good starting point or example code if you want to write your own interface to google calendar in ruby. Includes a setup wizard for handling the authorization process as well as script installation.
Y Simple and kicks ass. Type in decimal, octal, hex or binary, and this outputs all the possible formats.
Homepage Download Changelog html2jpg
Y Converts HTML pages to images (gif, jpg, png, ps, etc..). Very kludgy, only works with certain versions of Mozilla, but I needed a way to automate screen grabbing the HTML window out of a browser (for my album project). Maybe it'll help you. If you have KDE, I recommend khtml2png
Y Transfer images to your iPhone so the show up in "Photos" and the "Camera" applications. Can use iPod-convenience package to do the copy, otherwise can create a local directory of iPhone images that can be transferred manually with scp. Requires ImageMagick (convert/identify). Can only transfer to "Camera Roll" - if anyone knows how to create other albums, please let me know. Updated 2009/12/26 to work with v3.0+ firmware. Also see vid2iphone (doesn't do transfers).
Homepage Download LocationExample
Y Example Android project that creates a simple but complete location app. It uses Google Play Services and Google Fused Location Services (the latest location API) to do location updates and properly handles the lifecycle as well as turning location lookups on and off.
Y Recursively links a bunch of directories with either soft (-s) or hard links. It makes a matching directory structure and then links all the files in each one. You can also specify a regexp to -ignore certain files. Useful for copying a large file tree for testing without using alot of diskspace. Can also keep a 'history' of files seen so you can remove them from the new tree and not have them re-added if you rerun lnR.
Y A perl library that writes KML files for Google Maps and Google Earth. Can do the Geocoding (latitude/longitude lookups by address) using the Google API or Includes a simple HTML example that embeds the KML map using the new Google Maps Javascript API v3 (because Google Maps no longer supports direct usage of the KML on See "perldoc" for information.
Homepage Download Changelog make_faq
Y Makes FAQs and such things. I use this to build: DaveFAQ and DaveHistory
Y Moves mp3/ogg file(s) according to their tags. Replaces the 'mp3mv' tool I had here previously. Requires vorbiscomment for oggs and/or id3tool for mp3s
Y Make extended xmms playlist. Takes a list or directory tree of mp3 and ogg files and creates a playlist sorted by artist, album, track, title. More importantly it can write EXT metadata for xmms (Turn on "Read meta data from playlists" in preferences) so your playlists have song name and duration info immediately available to xmms. Is currently butt-slow for oggs because ogginfo is butt-slow, run it as a cron job.
Y Simple yet kicks ass. Moves or copies files using regular expressions. Thanks to Andrew Allen for the idea, which I'm sure he stole somewhere else.
Y Downloads films from youtube and iFilm to your hard drive. Converts youtube flash films to .mov if "ffmpeg" is available. If the format changes, let me know. Works with youtube as of 2011/12. Works with iFilm as of 2006/05. Requires perl and "lynx" or "GET"
Y Convert oggs to mp3s, converting ogginfo tags to id3 tags. Requires: ogg123, ogginfo, id3tool and an mp3 encoder, perl and nothing else. I've had a bug report that this might be limited to 48 minutes, I'd love more info on this.
Homepage Download perlc
Y Perl to C 'compiler' for hiding perl source code and creating an executable for distribution. Also has simple support for limiting distribution. (Not true compilation!)
Y A variation of my perlc actually written in C by Dimitar D. Mitov with a number of features: Can automatically detect libperl.a, does dependency scanning, static linking, AES 256 CTR encryption using disk device or 1st Mac address. (Not true compilation!)
Homepage Download Changelog pemf
Y I got tired of procmail and the like, so I just wrote my own mail filter that's easy to control and can do simple things like remove MIME. MIME sucks. If you can't vi it, it sucks. It can also catch SPAM, auto respond to email, forward email, blah blah blah. Everything that procmail can do, but it's perl, so it's better. Perl rocks.
Y Remote diff (with recursion). Similar to rsync or scp, but shows diffs between a local directory/files and the same path on a remote host. Currently requires that the absolute paths are the same on both machines, but it wouldn't be too difficult to make that an option.
Homepage Download Changelog scurvy
Y Lets you easily write screenplays or scripts in a simple text format, then converts them into the proper screenplay format. Also imports some RTF and Final Draft formats and can convert to multiple formats as well.
Homepage Download Changelog serverizor
Y Converts a generic command into a tcp server so you can disconnect and reconnect to it from the command line. This is actually pretty handy.
Homepage Download Changelog site_index
Y Multi-page HTML site index generator for local domains. See examples at any of my domains. Companion to whats_new
Homepage Download Changelog spigot
Y Spigot is an easy way to turn on and off printing of text according to patterns matched and other simple rules. Like a combination of 'expect' and 'cat' and 'head'. See usage for simple examples.
Y My first published ruby gem. A persistent simple Hash backed by sqlite3. Contains (almost) the same features/API as the Ruby 2.0.0 Hash object. Also completely tested with rspec, making it a reasonably simple rspec tdd ruby example. Also on github
Homepage Download Changelog tcp_forward
Y Forwards a TCP connection and lets you snoop and filter the traffic being sent. Uses the simple IO::Socket server/client examples in the perlipc manpage.
Homepage Download thumb
Y Just a thumbnail generator, except that it makes thumbnails the same size while keeping aspect ratio by cropping - so the pictures aren't stretched. This looks better than I expected - and is the code I use for the cropping mode of 'album'
Homepage Download libExpr.rb
Y Ruby expression tree generator. Can convert expression strings such as "(7*3)+(var/2)" into an expression object that can be very quickly evaluated (and can handle offloading variable evaluation). Can convert to RPN, Prefix and AST (abstract syntax tree) and has a flexible precedence model that includes presets for Ruby precedence or C precedence. Uses the shunting yard algorithm, but also supports unary (such as '-a' or '+a') as well as ternary (such as 'a?b:c') operations as well as short-circuiting logic operations (such as 'a||b'). Only AST supports all of these features, see the docs at the top of the source for more info). Also has a testbench that generates random expressions and verifies correct operation. It's a tar.gz, but you can also just look at the source and the testbench here.
Y Ruby "Marshalable" class with simple exclusion mechanism for Marshal.dump. Inherit this and use 'marshal_exclude' (much like 'attr_accessor') to specify any variables that should be excluded from marshalling, so you can avoid TypeError exceptions.

Author: David Ljung Madison Stellar [CONTACT] - My home.
LICENSE Free? Reporting Bugs

"I have an elegant script for this, but it was too big to fit in the margins.."

- Me, MarginalHacks

Thanks to Jamie Zawinsky and the Jargon File for the name

There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult. - C.A.R. Hoare

Terms Of Use | Site Index | CONTACT | PGP Key | MarginalHacks, Marginal Hacks