JC's Demos
JC's Demos

This is John Chambers' directory of interesting demos. What is here will change from time to time, as I change my mind about which demos I want to make public. Here are the current demos:


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

WWW demos

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.
This is a webified version of the Unix cat ("catenate") command. It reads one or more URLs and writes their contents to standard output. This program originally required the libwww module, but performance problems (especially the problem of hung connect calls) encouraged replacing it with some special-purpose high-performance modules. So if you are curious about such things, you might examine the modules used by this program.

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.
This is a package that uses weather'com's XML data service to provide weather information in a fast, compact form. This is a simple example of the power of the Web to leverage data from one or more separate sites, and provide a useful user service on another site.

The keyword-based search sites are useful, but have obvious problems, so people have started working on specialized search tools that have an understanding of their topic. This is a Web "spider", tailored to look for the ABC music notation and build index files for the contents. This is the basis of my tune finder. It starts from a list of URLS, and follows links to a depth of N, reading each page and extracting ABC header information. This program is only the search portion of the task; see the bot/ directory for the full story.

Character Set demos

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).

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

Network Management demos

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.

JavaScript demos

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.


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

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:

renames a file by adding '-' to its name. It's recursive, of course.
the stripped-down version of the libwww module. Very useful for all but the most complex and sophisticated web applications.
simple date-time routine.
is a popup-help package for tcl/tk (wish).
produces a simple HTML listing of a directory.
makes HTTP connection to a host, returns open file.
returns open file for a URL, data only (no HTTP headers).
expand HREF to full URL.
returns open file for a URL, prepared to read HTTP headers.
discards parameters from a URL.
verbose-mode init routine.

Many of the following programs use the above modules:

lists files with the same name but different contents.
lists all the *.h files in the system.
lists files that are large and aren't being used.
Kill.bsd, Kill.sys5, Kill.linux
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.
Calls nslookup and strips off all its verbiage, so that its output can easily be used in scripts.
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.
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. This script also demonstrates how to correctly do non-blocking I/O with a subprocess that writes partial lines to stdout. (This is very tricky in tcl.)
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.

Active button