Craig Agricola's Junk

Since has become our family website, I need a place to put all the junk that has nowhere else to go. This is that place...



Should you be interested in hiring me, you may contact me at craig (at)
If you would like to take a look at my resume, you can grab either the PDF or TXT format.


My current public key can be grabbed
here. The key id is 0xE5ED38B154523D4D, and the fingerprint is DDE1 71D7 C7E8 F1F0 1CED 4B8E E5ED 38B1 5452 3D4D. If you have something important enough to encrypt when sending it to me, or if you have received something that I've signed, please email me to confirm the fingerprint and/or get a phone number where we can verify the fingerprint.


I'm hugely interested in Bitcoin, both as a deployment of crypto, as well as a social movement. I think the ability to take control of the decision to not spend fees to mitigate risk in online trades, as well as the ability to trade much more anonymously is a huge gap that Bitcoin is filling.

If you find anything on this page useful, and are feeling charitable, I would be delighted to receive BTC at my Bitcoin donation address:
1AGriCoCBRbgca61ZJrqgVt78HJ94QXNcg (firstbits 1agricocb)

Also, I participate in #bitcoin-otc on Freenode, and as part of the OTC Web of Trust, am registered as agricocb with a separate GPG key id 0x0ADAC37F0E63E6E8, and fingerprint
7A28 BF7E 5AF8 7D49 917E 4DE1 0ADA C37F 0E63 E6E8.

In the interest of promoting Bitcoin, I'm willing to act as a local exchanger in the greater Burlington, VT area.
I'm also listed on LocalBitcoins, if that's your poison, as agricocb

Patent Applications

"A Method and Apparatus for Eliminating Instruction Pipeline Hardware Stall Logic Related to Data Access in a Central Processing Unit"
I left IBM before this made it from IBM's lawyers to the USPTO, and as far as I know, with nobody to follow up on it, it was lost in the machine...
"In the routing of data traffic to a common destination egress queue from a plurality of customer subscribers each contracting for respective allocations of bandwidth of data flow, a technique and system for fairly sharing any underutilized excess bandwidth and for data dropping amongst over-subscribers, while guaranteeing each subscriber its contracted-for bandwidth, and further enabling billing over-subscribers for their share of received excess bandwidth--all while maintaining the granularity of the contracted traffic flow."
Local copy of the PDF USPTO Database Lookup

Web hacks for sharing

If you find any of this useful, please consider throwing a few BTC
my way.
zip4 I have become addicted to Firefox bookmark macros. I love being able to type my search queries right into my URL bar. For quite a while, I've wanted the same facility for the USPS Zip+4 database, but the only interface that they give to the database is a form that you have to fill out and submit. Unfortunately, bookmark macros won't distribute the argument to multiple places in the target URL. So, I created a tiny PHP script that parses it for you, and then redirects you to the appropriately constructed USPS URL. Since YubNub provides bookmark macro functionality to all the other browsers too, I published the zip4 command there too.
If you want to create a Firefox bookmark macro, click here and select a spot to put the bookmark. Then go into the "Bookmarks Manager", click on the bookmark, and then click on the "Properties..." button. In the "Keyword:" field, put something like zip4. Then you can enter things like zip4 1600 Ampitheatre Pkwy, Mountain View, CA into your URL bar and get the USPS Zip+4 lookup.
FireFox Image Bookmarklets A few quick and dirty bookmarklets for manipulating images in FireFox. They allow you to scale images to fit the width, height, or visible area of your browser, as well as rotate the images 90° before scaling. I threw them together because I find it to be a bit of a pain to view scanned documents in FireFox, since viewing them at full size requires a lot of side to side scrolling, and viewing them scaled to fit the window is usually too small to read. But doing a Fit-to-Width is perfect, and if the page is layed out in a landscape format, rotating by 90° and then doing a Fit-to-Width makes it much easier to read.

PostScript hacks for sharing

If you find any of this useful, please consider throwing a few BTC
my way.
Ruled Printing Paper This is just a simple PostScript hack that I threw together when I needed some paper for my kindergartener to practice her printing on. It has lines on it similar to what I remember from when I was a kid, with the two solid lines that define the top and bottom, and then a dashed line in between them to help guage the middle height.

Code for sharing

If you find any of this useful, please consider throwing a few BTC
my way.
netjail My neglected SourceForge project. Netjail is a pre-loadable library to foil outgoing net connections. It's good for providing a sandbox to jail possible call-home software.
X11::WM::Sawfish My only contribution to CPAN so far, X11::WM::Sawfish provides access from Perl to the sawfish window manager. Both the X properties and the UNIX socket based methods are available, with the socket based mechanism falling back on the X properties method, so that you maintain the network transparency of X windows. Since sawfish is controlled by evaluation of librep (Lisp-based) forms, this simple module gives you complete control over the window manager, and should be future-proof, since all new functionality will still be accessible with the librep forms.
bandwidth_monitor Polls /proc/net/dev (which probably limits its use to Linux) for the byte counts for a given network device, and calculates the RX and TX bandwidths. Originally a shell script, then a Perl script, now rewritten in C so that it can easily be used on embedded devices like the Linksys WRT54G as well as.
super_tee Simply duplicates both the standard output and standard error streams from a command to a log file, while marking the lines in the log to indicate which stream the lines came from. This is essentially the same idea as the standard UNIX tee command, except that in order to use the tee command for both streams requires that you lose the distinction between the two streams. super_tee solves this problem by invoking the command as a child of super_tee, rather than just piping the output of the command into it, as tee does. Since the goal is to keep the differentiation in the output log between the two input streams, super_tee also has the nice property of untangling lines that may have been interleaved together from the two streams. As an additional feature, timestamps can be added to each line as they are written to the log.
x_idle_monitor As I'm sure many other geeks do, I often find myself measuring my time by when I've taken breaks from the computer. So, in order to know exactly when I've left the computer, I wrote this simple idle time monitor. It uses the idle time from X windows, and when it exceeds a programable threshold, the time is logged. When the idle time goes back to 0, the time is logged again.
getopt_auto A wrapper for the standard getopt_long() facility, just to make things that much easier. It takes a data structure that describes the options and it takes care of the parsing of the values and printing of the help page. Of course, with more things being taken care of, it adds additional limits, but for most of my quick n' dirty projects, this is all I need.
raster2vector This project started because I wanted a scalable PostScript version of my signature, which I had scanned. The tool takes an image in PNM format and creates PostScript code to trace over the non-white bits. This only really makes sense if the image input is an edge map (see canny_edge below to make an edge map from a regular image). While writing this, it occurred to me that this is also a pretty good way to efficiently store scanned documents, assuming that you want a high resolution monochrome representation of the scanned page for storage. The project still has plenty of room for improvement. Of course, after I had finished it to its current state, I found potrace, which is a very very similar, though much more mature, project. As far as I can tell, the algorithms used are completely different however, so depending on the input and the desired use of the output, one might perform better than the other. In my limited testing, my raster2vector produced significantly smaller output files, which is obviously better for archiving scanned documents, but it was by no means an exhaustive or objective study.
canny_edge When looking for a piece of software to do Canny edge detection, I found, which seems to be a redistribution of (linked from, which has only two flaws, as far as my raster2vector project was concerned. The first is that it is not implemented as a filter (image on stdin --> edge map on stdout). The second is that it is distributed as a few files concatenated in a text file, with no make file. This is just a perl script to extract the source from the text file, patch it to function as a filter, and provide a Makefile.
Update 2014Jul13: It appears that all of the above source links for canny.src seem to have disappeared over time, so I'm putting up the copy that I grabbed here. If Mike Heath or Sudeep Sarkar, the original copyright holders, would like me to take this down, please contact me at craig (at) Discover Card has been intelligent enough to provide OFX (Online Financial Exchance standard) support for quite some time, though they expect you to use software like Microsoft Money or Quicken to access it. The beauty of OFX, though, is that it is an open standard, and is based on XML, which means that there are plenty of ways to use the data without having to rely on a financial software package. I wrote this so that I could get the raw OFX data. If you are interested in actually looking at the returned OFX data, you might want to look below for, which will make it much easier to parse visually. This is just a quick hack to format XML input with tags on their own lines (except for leaf tags, which are displayed on the same line as the data they contain) and indentation to make it easier to see containment. This is a 5 line script, which uses XML::Grove::AsPrettyXML to do all the work. XML::Grove::AsPrettyXML is almost entirely copied from Ken MacLeod's XML::Grove::AsCanonXML, with only minor modifications, so instead of making it a new package, I just decided to include it with the application that I needed it for.
If you find any of this useful, please consider throwing a few BTC my way.

Since most search engines ignore META-keywords and comments now, I'll make sure to put all the combinations of my name, as well as the word "Homepage" here, in case anybody is interested in finding me.
Craig Agricola, Craig B. Agricola, Craig Barrett Agricola, Homepage

All content on this page is copyright (C) 2001-2011 Craig B. Agricola