| 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. |
| 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
http://www.arches.uga.edu/~yling/canny_src.txt, which seems to
be a redistribution of
ftp://figment.csee.usf.edu/pub/Edge_Comparison/source_code/canny.src
(linked from
http://marathon.csee.usf.edu/edge/edge_detection.html),
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. |
| get_discover_ofx.pl |
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 PrettyPrintXML.pl,
which will make it much easier to parse visually. |
| PrettyPrintXML.pl |
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. |
All content on this page is copyright (C) 2001-2006 Craig B. Agricola