JC's Tools

This is John Chambers' directory of useful tools. What is here will change from time to time, as I change my mind about which tools I want to make public. At the end is a complete list of the files here. But first a list of the more interesting tools:

Documentation

Unix manuals online
A simple web interface to the standard Unix online manuals. This uses the m2h CGI script.

WWW tools

ae
Ever wonder what your browser tells the server? This script sends you a dump of its arguments and environment. You can experiment with adding stuff to the URL, then hit Return and it will show you how the URL is parsed. Here's the source.
w3cat
This is a Web version of the Unix cat ("catenate") command. It reads one or more URLs and writes their contents to standard output. It has options to show you what's happening, so it is useful for debugging network problems. This program originally used the libwww module, but performance problems and hung connect calls led to replacing it with some special-purpose high-performance modules. If you are curious about how to do such things, you might examine the modules used by this program.

w3ld
This does a download of a web directory to the current directory. It is recursive to a specifiable depth, so it can produce a mirror of a directory tree. But it only works with directories that look like directories; it can be defeated by an index.html file.


Character Set tools

PC Keyboard mappings
For software that uses the ALT key to shift to the upper 128 characters in the ISO 8859 character set(s), this show what characters you get. Most linux software, some BSD, and assorted other programs do this.
The ISO 8859-1 character set
This is a list of all the 256 characters, one per line, showing the hex, octal, and decimal encodings, plus the actual character (for printables) and its descriptive name (for non-alphanumerics).

chrset,
The chrset file is a small perl program that outputs the entire annotated character set.

Network Management tools

SNMP Over the Web
SNMP agents can take months to get working, they are difficult to use, and are very slow due to the need to do a series of get-next requests to get a table of information. This is a demo of getting the same information via HTTP. It took me a day to implement, including a couple of "private MIBs". It fetches entire tables with a single request, so it radically outperforms SNMP for table accesses. Why would anyone bother with SNMP any more?

Monitor interfaces
A tcl (wish) script that produces a constantly-updated display of the states of a machine's interfaces.

Ping continuously
A tcl (wish) script that displays a list of remote hosts and the timings for pings repeated at N-second intervals.

JavaScript tools

Popup Help Window
Several ways to get a new window to appear that contains some "help" information from a separate file.
Image preloading
This is a JavaScript demo that shows how to preload images for a second page. It also shows and explains how this may be misused by unscrupulous web sites to embarrass you.

Browser ID
JavaScript demo showing how to identify the user's browser and send different data depending on browser type.


Tools

This is a list of shell, perl and tcl tools to do some useful tasks.

Modules
Many of the perl and tcl programs here use one or more of the following modules, so I've put them all here for easy downloading:

Backup.pm
renames a file by adding '-' to its name. It's recursive, of course.
CGI_Lite.pm
the stripped-down version of the libwww module. Very useful for all but the most complex and sophisticated web applications.
DT.pm
simple date-time routine.
Help.w
is a popup-help package for tcl/tk (wish).
HTMLdir.pm
produces a simple HTML listing of a directory.
HTTPcon.pm
makes HTTP connection to a host, returns open file.
Source.w
is a wrapper for the tcl source command that searches $PATH.
URLdata.pm
returns open file for a URL, data only (no HTTP headers).
URLhref.pm
expand HREF to full URL.
URLopen.pm
returns open file for a URL, prepared to read HTTP headers.
URLtrim.pm
discards parameters from a URL.
Vopt.pm and Verbose.pm, Verbose.w
Verbose-mode init routines.

Programs
Many of the following programs use the above modules:

ABC music programs
abc, abcgui
is an experimental browser helper for ABC music notation.
abc2bars
produces the first two bars of each of a list of ABC tunes.
abc2html
converts ABC music notation to HTML.
abcDesc
builds a .htaccess file from .abc files showing the titles.
abc_netscape
is a netscape helper for ABC music notation, which converts the file to PostScript and starts ghostview to display the results.
abccode
is a script that reads ABC music files and outputs numeric codes for the tunes, using the abcCode.pm module.
abcjoin, abcmedley
join ABC music files, and optionally renumber the tunes, in somewhat different ways.
abcpar
add parallel like to a chunk of ABC music notation.
abcsplit
extracts ABC tunes from a file and writes each to a file whose name is based on the first title.
Converts hostnames to IP addresses and vice-versa. There is no verbiage, so that its output can be used in scripts. See also NSlookup
abctoc
generates a table of contents from ABC music files.
abctr
transposes a fragment of ABC music notation.
Addr
A perl wrapper for the nslookup command. It strips away all the "user-friendly" verbage, so you can use it in other scripts.
anon.ftp
is a sh script to configure anonymous FTP. Some systems still come without this working, and someone at IBM created a very portable script to do the job.
b-c
converts the verbose-ized *.b files to *.c files, selecting and/or suppressing verbose output.
b64d
decodes base-64 files.
bmod
verbose-izes *.c files, making them compatible with the V.h package.
Bp
is a simple backup-in-place script, that (recursively) adds a hyphen to the end of one or more file names. You can restore them with Rs
cpdir, lndir
does a recursive copy of a directory tree, creating all the target directories and either copying or linking all the files. If you want to see how to recurse through directories in perl, you might look at this program.
DC
is a little tcl-coded Desc Calculator. When the fancy one in the system library won't do what I want, I just add a new button to this one and bind it to a proc.
Deliver
is a mail-delivery program, useful in testing email failures.
FindDiffFiles
lists files with the same name but different contents.
FindHdrFiles
lists all the *.h files in the system.
FindWaste
lists files that are large and aren't being used.
Helper
is a generic "helper" program that will start up a program to handle a file. It works with browsers and other programs that need a similar plugin "handle this file" capability. Its config file is a simple, non-proprietary format that you can edit with any editor.
HomeDir
produces a list of users' home directories, with no extraneous text, so you can use it in a script.
Hosts
converts nslookup output to /etc/hosts lines.
IF
displays the status of a machine's interfaces, updated every N seconds.
Kill.bsd, Kill.sys5, Kill.linux
are scripts that kill processes based on a grep of a ps listing. Different versions are needed due to the variety of ps commands.
IFind
searches all the system include directories for patterns. This is useful when porting programs to a new machine and the #include lines produce "no such file" errors or the macros come up as undefined functions.
These are scripts that kill processes based on a grep of a ps list. Different versions are needed due to the variations in the ps command, but one of these should work on most Unix-like systems. We also have Kill.aix, Kill.hpux, Kill.solaris, Kill.sunos and, but these are probably the same as one of the above.
Man
converts a man page to plain text, suitable for editing. This uses the stripman command to remove underscores and other unprintable stuff.
Man.html and m2h
are a web interface to the Unix online manuals. You can look up a man page from your browser, and references to other man pages are converted to hyperlinks.
mfl
sorts the names in a Makefile macro definition. This is an example of a tool designed to be called with vi's !cmd mechanism to rewrite a chunk of text.
Monitor
is the tcl/tk interactive tool "rmt", renamed because "rmt" is a common Unix commant. This is an interactive debugger for tunning wish scripts, and is an excellent example of how to do IPC using tcl's simple, elegant "send" command.
Mrpl
builds a reply header from a block of email headers.
NSlookup or
Calls nslookup and strips off all its verbiage, so that its output can easily be used in scripts. See also Addr
O8, OF, OV
alphabetizes and balances a list of .o files in a Makefile. This is a really obscure example of a special-purpose tool designed to be called with vi's !cmd mechanism to do some specific text massaging. See mfl for another such text tool.
pctbar
is a wish script that produces a percent-completion bar.
Pings,
a wish script that produces a window with a running display of a list of machines and how they are responding to pings.
PurgeFiles
searches through directories for links to one or more files, and deletes all of them. Useful for getting rid of old versions and backups, no matter what they may be called.
Rmake
is a recursive make, that searches through subdirectories and makes the targets anywhere that they are found.
Rp, Frp, Vrp
is a perl program that does match-and-replace on a list of files. Frp rewrites only function names; Vrp rewwrites only variable names.
Rs
restores files backed up via Bp
RSA
is the famous RSA encryption in three lines of perl. (There is also a nice t-shirt with this code on it, which is available for sale. If you would like to be an international arms distributor, you can become one for just the price of this t-shirt. Buy one before it becomes legal! ;-)
rename
does perl pattern match and replace on file names. This is an excellent example of something simple and useful which is very easy in perl, and nearly impossible with any other common tools.
Pings
is a tcl/tk (wish8.0) script for monitoring a list of hosts. It pops up a window showing a list of hosts. It runs pings on ay or all of the hosts and shows the responses. It can also use traceroute to discover the route to a host, and ping any or all of the hosts along the route.
Start
is a tcl mimic of the MS-Windows Start button.
SumCol
sums a column of numbers.
supplant
searches directories for files with the same name, and makes them links to an "authoritative" version. This helps eliminate the confusion and waste space caused by the "broken link" problem.
DC
produces a window with a list of TCP connections. It is updated every N seconds, and you can specify a (grep) filter to select only certain sets of connections.
DC
is a simple protype of a tcl TCP server process.
Test
is a software-test program. It runs a suite of tests, compares the results with samples of correct output, and reports failures.
DC
is a tcl wrapper for the traceroute command.`
DC
is a tcl program that maintains a central cache of the contents of URLs. Other processes use the source command to ask for URLs and get asynchronous notification when the contents arrive.
Unshar and UnpackKit
unpack a flock of shar kits. They have somewhat diferent extra goodies.
DC
unpacks a (possibly compressed) tar kit.
Upload
is a CGI script that copies files to a server's incoming-files directory. It is designed to be invoked via an HTML form or hyperlink.
WNG
is "Write to News Group", and sends one of a short list of canned responses to messages that shouldn't have been posted to the newsgroup.
DC
is a perl script that knows how to build the whatis files used by the man command.
XR
displays X resources, and helps you edit them.
XRGB
lists all the color names known to your X server, and lets you select them as foreground or background colors so you can see what they look like. It can also send the color names to a parent wish process, so it functions as a generic color chooser.
XV
is a tcl wrapper for the xv command. It includes a prototype directory-tree routine.
Xrand
produces an xterm window with random colors.
Zap
wipes out the contents of files.

Everything

Here's the full list of everything, in alphabetical order: