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:

Documentation

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

WWW demos

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

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

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

chrset,
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.


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.
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
verbose-mode init routine.

Programs
Many of the following programs use the above modules:

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.
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.
NSlookup
Calls nslookup and strips off all its verbiage, so that its output can easily be used in scripts.
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. 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.)
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.

Active button
      Name                    Last modified       Size  Description

[DIR] Parent Directory 16-Mar-2014 11:29 - [TXT] 23-May-2006 18:36 1k [   ] ABCbot - [TXT] Backup.pm 30-Apr-2005 23:21 2k [TXT] BrowserID1.html 28-Aug-2001 23:08 1k [TXT] CGI_Lite.pm 27-Apr-2005 17:19 26k [TXT] DT.pm 20-Jun-2009 20:58 1k [TXT] Elastic.html 29-Mar-2001 17:30 1k [TXT] FindDiffFiles 01-Oct-2002 09:20 3k [TXT] FindHdrFiles 02-Mar-2000 10:27 1k [TXT] FindWaste 01-Oct-2002 09:20 2k [TXT] HTMLdir.pm 29-Mar-2011 10:20 2k [TXT] HTTPcon.pm 05-Oct-2005 20:08 5k [TXT] Help.w 23-Feb-2000 13:22 13k [TXT] HelpText.html 28-Aug-2001 23:08 2k [TXT] HelpWin.html 14-Aug-2005 00:26 3k [TXT] IF 16-Nov-2010 14:00 23k [TXT] ISO8859-1.txt 19-Feb-2004 21:00 8k [TXT] ImgPreload.html 28-Aug-2001 23:08 1k [TXT] ImgPreload1.html 10-Dec-2001 14:27 5k [TXT] JSarrow.html 28-Aug-2001 23:08 2k [TXT] JSelastic.html 28-Aug-2001 23:08 8k [TXT] JSelastic1.html 29-Mar-2001 18:16 1k [TXT] JShummer.html 28-Aug-2001 23:08 2k [TXT] JSorbit.html 21-Nov-2000 17:11 5k [TXT] JStetris.html 28-Aug-2001 23:08 16k [TXT] JStrailMsg.html 28-Aug-2001 23:08 2k [TXT] Kill.aix 08-Mar-2000 10:01 1k [TXT] Kill.bsd 08-Mar-2000 10:01 1k [TXT] Kill.hpux 08-Mar-2000 10:01 1k [TXT] Kill.linux 07-Jul-2001 12:51 1k [TXT] Kill.solaris 08-Mar-2000 10:01 1k [TXT] Kill.sunos 08-Mar-2000 10:01 1k [TXT] Kill.sys5 08-Mar-2000 10:01 1k [TXT] Man.html 20-Mar-2000 13:57 1k [TXT] Man.html.orig 20-Mar-2000 13:04 1k [TXT] NSlookup 01-Oct-2002 09:20 1k [TXT] PCkbd.txt 21-Nov-2003 09:24 1k [TXT] PSftr 18-Sep-2008 15:21 3k [TXT] PShdr 14-Oct-2005 13:51 2k [TXT] Pings 17-Apr-2003 18:51 34k [TXT] SmartTagsOff.html 11-Aug-2001 09:38 1k [   ] Source.tcl 03-Dec-1999 14:21 2k [TXT] URLdata.pm 03-Dec-1999 14:08 2k [TXT] URLhref.pm 26-Jul-2006 15:02 1k [TXT] URLopen.pm 03-May-2012 00:21 6k [TXT] URLtrim.pm 01-Apr-2003 10:43 1k [TXT] Verbose.w 25-Sep-2002 17:08 2k [TXT] Vopt.pm 12-Jun-2009 22:15 2k [TXT] ae.cgi 08-May-2009 19:15 2k [IMG] but_off.gif 03-Apr-2000 15:20 1k [IMG] but_on.gif 03-Apr-2000 15:20 1k [TXT] chrset 03-Dec-1999 14:21 7k [DIR] crash/ 29-May-2003 12:08 - [   ] elastic.js 12-Jun-2003 17:37 6k [DIR] html5/ 22-Apr-2011 09:32 - [TXT] hummingbird.html 15-Mar-2001 19:50 1k [TXT] img.html 15-Apr-2006 23:51 1k [DIR] img/ 09-May-2003 16:52 - [TXT] keyboard.txt 15-Oct-1999 16:15 1k [TXT] kill.freebsd 08-Mar-2000 10:01 1k [TXT] m2h 13-Oct-2004 21:39 5k [TXT] m2h.pl 20-Mar-2000 13:59 5k [TXT] mailto.html 08-Mar-2000 10:01 1k [TXT] marqee.html 15-Apr-2006 23:46 2k [DIR] msgbad/ 31-Mar-2011 20:20 - [DIR] pl/ 21-Jan-2004 14:23 - [DIR] pm/ 21-May-2011 09:27 - [TXT] proto 01-Oct-2002 09:20 1k [TXT] proto.b 26-Apr-2002 11:17 1k [TXT] proto.cgi 14-Oct-2009 15:47 2k [TXT] proto.d 01-May-2002 09:06 1k [TXT] proto.html 24-Feb-2006 20:37 1k [TXT] proto.pl 21-Apr-2005 11:55 1k [TXT] proto.pm 03-Dec-1999 14:21 1k [TXT] proto.w 05-Nov-2003 11:39 3k [   ] proto_pl.sh 01-Oct-2002 09:20 1k [DIR] ps/ 07-Jun-2006 14:07 - [   ] read.sh 10-Feb-2004 15:21 1k [TXT] redirect1.html 28-Aug-2001 23:08 1k [TXT] redirect2.html 30-Apr-2001 15:10 1k [TXT] redirected.html 30-Apr-2001 15:14 1k [TXT] rename 01-Oct-2002 09:21 1k [TXT] supplant 01-Oct-2002 09:21 3k [TXT] tcpproxy 08-Mar-2000 10:01 64k [DIR] test/ 12-Sep-2006 16:38 - [TXT] w3cat 05-Oct-2005 20:09 12k [TXT] w3ld 01-Oct-2002 09:21 21k [TXT] webcat 03-Feb-2012 23:10 51k

Apache/1.3.41 Server at trillian.mit.edu Port 80