These are various bits of code that I've compiled, modified, or written in no particular order. All are presented here as a service, with no warranty and all that. (Unless otherwise stated, all code written by me is licensed under the GNU GPL.)

Please, please, if you want to link to any of the stuff here, link to this page. Since I'm still building this up, I guarantee that the locations of things here will change.

Also, I'd really like to know if anyone is using this stuff. If you think about it, drop me an email to let me know what you're using and if you have any suggestions.

As I have time, I'm putting my Perl stuff on CPAN. See authors/id/S/ST/STEVE/ on your favorite CPAN mirror.

To help with the PA-RISC Linux port, I also have lots of HP-UX 10.20 and 11.0 packages for various things (gcc, binutils, other GNU software) on


getfile - Perl/LWP script essentially equivalent to lwp-mirror, but with an extra option or two and a little extra paranoia for good measure. (Documentation)

linkdups - Hard link duplicates. Usual invocation would be something like linkdups -r directory.

md5sum - Perl implementation of md5sum(1) that at least tries to look like the GNU implementation. It's mostly useful as a base for other scripts or for those times when you are stuck on a system with Perl but without GNU tools.

pipeto - Runs the program specified on the command line if and only if there is input on stdin.

run1 - Perl script that runs one copy of the program specified on the command line at a time. Useful for those regular cron jobs that can occasionally run long and stack up. (Documentation)

wipe - Perl script that overwrites then unlinks files. Useful for wiping somewhat sensitive data. (Documentation)

sendfile - Takes an email address and any number of filenames as arguments, and sends the files as MIME encoded email. This is a good example of what can be done easily with MIME::Lite. The script requires MIME::Lite, and possibly MIME::Base64.

loadmon - A small program that monitors your peak load average. I wrote it when I was playing with fork() bombs. It's written in C. It's probably completely worthless to anyone not on a glibc-based Linux box in its current state. (The signal handling relies on the BSD-style signal() in glibc, and the load average is pulled from /proc/loadavg.)

mkfile.c - A little program that can create files in a safe fashion. I wrote it for use in a shell script where I wanted to make sure I didn't clobber a certain file. The program provides lock file behavior. It seems to work properly on Linux and HP-UX. (I'll provide a man page and a perl implementation Real Soon Now.)

This is obsolete. Red Hat has included netcat for a while now.
My netcat rpms. These aren't much different than what you'd find in Red Hat's contrib tree, except that these are "proper" pristine-source based rpms. I also used netcat as a just-slightly-nontrivial example for building my first rpms.

This is obsolete (or at least horribly out of date).
My perl rpms, compiled on Red Hat 5.0 (so they are glibc-based). They include a tiny patch to the linux hints file to make Configure default to building, which is convenient if you want to do any of the interesting stuff with embedded perl (like mod_perl, nvi, etc.). - Takes an rpm on stdin and outputs a gzipped cpio archive on stdout. It's a trivial script, but I wrote it to refute some whining that you can't handle rpms with "standard" tools. The obvious argument here is that you still need perl, gzip, and cpio, but if you don't have those, what world are you living on? :-)

chkkernel - Compares the kernel version you are running to the latest stable & beta kernels and reports the latest version, or that you are running the latest version. It works by essentially doing a finger without calling an external finger program. (Note: This isn't the greatest code for various reasons, but I put it here in case it would be a useful socket code sample.)

mailform - Sends form results via email. Somewhat compatible with by Phillip Moore. Designed to be mod_perl friendly. Includes documentation in pod format. Requires and Net::SMTP. I'll probably modify it to use MIME::Lite or something soon. Note: This thing is a security problem. I have quick hack to fix it that I'll post here sometime soon. Email me if you need it.

line - Displays a specified line of a file with optional context. Includes documentation in pod format.

String::Random - Perl module to generate a random string based on a pattern. (You can get this from CPAN.)

randstring - Generates a random string based on a pattern specified on the command line. Uses String::Random (see above). (Here is an older, less efficient version of the script that does not use String::Random.)

test-CGI - Kind of like the test-cgi script that has been shipped with NCSA httpd & Apache for years, but it uses It outputs the values of $query->param and $query->keywords.

iniparser - A ridiculously simple .ini-style parser (complete with no error/sanity checking) that simply reads the ini file and spits it back out at you. (Somebody was trying to figure out how to do this on IRC one day, so I decided to throw this together for fun.)

resolve - A simple perl script that resolves IP addresses in a common log format httpd log file. A log that looks like - - [09/Jan/1999:13:03:00 -0600] "GET / HTTP/1.0" 200 1131
would be output as - - [09/Jan/1999:13:03:00 -0600] "GET / HTTP/1.0" 200 1131
IP addresses are only looked up once per script run since results are cached (in the program - a persistent cache could easily be implemented with Data::Dumper). The script uses Net::DNS.

tempmontk - My first Perl/Tk script. Displays CPU and Mainboard temperature from /proc/sensors, using the lm_sensors module. (This script works with lm_sensors 1.4.12. I'll update it when I move to lm_sensors 2.x.) Run "tempmontk -- -small" to have something that looks decent when swallowed in the KDE panel or something similar.

lside - Silly little shell script that prints the models of your IDE devices on recent Linux systems. The output looks something like this:


1 device(s) found.

dict - Perl/LWP dict client of sorts.

namedmon - Perl script suitable for running from cron(8) to keep named running. Works on Red Hat. Works on Solaris with a small amount of tweaking. Especially useful for sites where either you are running a known-buggy bind, or you just can't afford to have any DNS servers go down.

cpanspec - Perl script used to generate a spec file (for building an rpm) from a module from CPAN. The format of the spec file is meant to work for


As much as I hate to admit it, I am occasionally forced to work with Microsoft's abysmal excuses for operating systems. Although Windows sucks, Cygnus's GNU-Win32 tools make it almost bearable at times. To make getting to a shell prompt a little easier, I edited Microsoft's "Command Prompt Here" PowerToy to provide "Shell Here". It should work on 95, but I can't swear that I've tried it on anything but NT. (Oh, BTW, download the .inf, right click on the file in explorer, and hit "Install".)

I've been hacking off & on for years on a df for {DOS,NT,95}. It is very loosely based on the df from the GNU fileutils. (I mostly just borrowed the format of the output. Eventually I'd like to add some useful subset of the normal GNU df options, or possibly even integrate this code with GNU df.) Here's the current version, which is known to run on NT and ran on 95 (more-or-less) before the last few changes I made. (The DOS version is currently unavailable, since I haven't looked at it in about 3 years, and it uses BIOS calls to get its information, meaning it is worthless on drives of any reasonable size.)

udptest.c - This is a very simple bit of code that starts two threads, one to listen for UDP, the other to send. Basically, when I wrote this I wanted to see if a vendor winsock.dll had any kind of UDP support, so I check for (I think) every possible error and report it. If nothing else, it's a simple example of Win32 threads and Windows socket functions. It compiles under BC 5. I'm not going to provide a binary, because if you don't have a compiler, you probably don't want this thing.

Steven Pritchard
$Id: index.html,v 1.9 2004/03/22 00:13:30 steve Exp $