Here are some tiny Perl tools I have written. (My more-serious stuff is available on
CPAN.) Descriptions are below; the code is in the file box (which most likely will be to the right of this text).
License
Unless otherwise stated, all of my code on this site is licensed under the
GNU General Public License, version 2 or greater. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The code
Data analysis and statistics
- histogram. Generates an ASCII histogram from numeric data.
- percentile. Generates an ASCII percentile plot from numeric data. (You can see an example plot in my 2003-11-24 journal entry.) Updated 2004-07-26.
- stats. Computes summary statistics for a set of numbers. If you pass in a set of whitespace separated numbers, either in files or via standard input, this program will compute various summary statistics for the set. The program will also attempt to ignore any non-numeric garbage that may be in the input. The statistics computed are count, mean, median (50% cutoff), min, max, 10% cutoff, 90% cutoff, variance, standard deviation, population variance, and population standard deviation. The output is in the tagged-data format used by tabulate. Updated 2004-07-26.
- tabulate. Converts tagged data into tabular data. This program takes files that contain lines of tagged data of the form tag-n=val-n, where a series of such tag-value pairs represents a record, and converts the data into tabular data, one line per record. If no files are provided, the program takes the data from standard input. The format of the output is tabular, with rows (records) separated by line breaks and column values separated by tabs.
Hackery
- LayoutRule.pm. A hack-riffic module that redefines Perl syntax to allow for Haskell-like (and, I guess, Python-like) layout blocks. In other words, you can use indentation instead of braces to determine code nesting. Oh, you can also omit statement-ending semicolons, if you so choose. Fun for the whole family! For some examples, see
my quick write-up on Kuro5hin.
Miscellaneous
- figlet-farmer.pl. Generates
FIGlet renderings of the given string using all available fonts.
- postnet.pl. Generates US Postal Service
POSTNET bar codes for ZIP, ZIP+4, and delivery point codes.
Performance engineering and load testing
- rand-exp-dist-vals. Generates a series of values drawn from X, an exponentially distributed continuous random variable. The exponential distribution is good for modeling independent arrivials (such as HTTP requests). This program can be used to generate realistic arrival schedules for load testing web servers.
Visualization
- ddl-to-graph. Generates an ERD-like directed graph showing the relationships among the tables and fields provided in the input SQL DDL. The graph is output in
Graphviz's dot format. This tool is great for those times when you have inherited a large database and need to understand it quickly.
- makefile-to-digraph. Generates a directed graph (in
Graphviz's dot format) from a Makefile. The graph shows the dependency relationships among the Makefile's rules. This tool is useful for visualizing a Makefile's dependency chains.
Web stuff
- make-photo-index. Generates a lightweight static website to display photographs. Creates thumbnails and weaves them into a HTML-4.01 index that links to the full-sized photos.
Win32 stuff
- netlock.pl. Locks the workstation if it leaves the network. This is a simple security precaution designed to hinder laptop-stealing criminals. Basically, this program pings a given host every so often, and if that host becomes unreachable, the program assumes that the laptop has left the network (i.e., has been taken) and locks it.