Adam M. Costello

Miscellaneous Small Utilities

[abiff] [acjpeg] [bgsub] [binhex] [bsplit] [butler] [checkmail] [colrm] [dateclock] [dvorak-to-qwerty] [dvorak] [dvorak-exrc] [find-perl] [find-posix-sh] [find-python] [find-tclsh] [find-wish] [grabkey] [h.soav] [hexbin] [iptoname] [link] [mkcat] [moved-command] [mp3to] [naughty] [netscape-snapshot] [paginate] [pnminterp] [ppmtogray] [ppmuncomposite] [run] [self.c] [] [sh-include] [showtext] [slow] [stereosoften] [uuconvert] [vt100resize] [whichkbd] [wondershaper] [wormhole] [xrsh]

Version 3.4.5. A perl script to which you can forward your mail. It notifies you on any set of hosts, in whichever windows you have notification turned on. Useful if you cannot log in to the mail host, and allows custom filtering. Uses rsh. [This is gross. There should be some general, efficient notification facility. Maybe someday I'll write one.] Version 2.41 is a Bourne shell script.

Version 0.2.0. A perl script wrapper around cjpeg that uses an alternative method to adjust the quality/size tradeoff. Whereas cjpeg linearly scales a single quantization table that was never designed for such a wide range of quality levels, acjpeg performs geometric interpolation between six reference tables: cjpeg's built-in table (used for -q 50), the "normal", "fine", and "superfine" tables used by the Canon Powershot S40 digital camera, and two extreme tables (all 1, and all 2047).

Version 1.0.1. ANSI C. Makes simple string substitutions in binary files.

Version 1.00. ANSI C. Converts a binary input stream to a text (hex) output stream. Works well with hexbin.c.

Version 0.5.1. A Tcl/Tk script that performs configurable actions using the current X selection. I use it to be able to highlight a URL and click a button to open a new Netscape window, or to highlight a word and click a different button to look up the word in the online Webster. Here is an example config file.

Version 1.01. ANSI C. Splits a binary file into several smaller files.

Version 1.0.12. A Bourne shell script that checks a list of email addresses to see when folks last read their mail. Follows mail forwarding chains to their final destination. Uses nslookup, telnet, and finger, among others.

Version 1.00. A Bourne shell script that emulates the BSD colrm command using awk. Useful on SysV systems that lack colrm.

Version 1.2.2. A Tcl/Tk script that displays a running clock whose textual date format is configurable, like the date command. And you can copy & paste from it.

Version 1.01. An Expect script that performs Dvorak->qwerty remapping. See also h.soav.

Version 1.00. Forks a shell in a new pty and performs qwerty->Dvorak remapping. Uses BSDisms. Known to work under SunOS 4. See also h.soav.

Version 1.01. vi macros that perform qwerty->Dvorak remapping. Useful when you're forced to work in an environment that doesn't allow keyboard remapping (like MS-DOS).

Lines to put at the top of a Perl script that allow perl to be anywhere in PATH. Requires the default shell to be Bourne-like.

Lines to put at the top of a POSIX shell script that allow the POSIX shell to be anywhere (in PATH or not). Requires the default shell to be Bourne-like.

Lines to put at the top of a Python script that allow python to be anywhere in PATH. Requires /bin/sh.

Lines to put at the top of a Tcl script that allow tclsh to be anywhere in PATH. Requires /bin/sh.

Lines to put at the top of a Tcl/Tk script that allow wish to be anywhere in PATH. Requires /bin/sh. This is just like find-tclsh, but note that wish will intercept some command-line arguments, which is usually what you want. If you don't, insert -- after "$0". Some other Tcl-based shells are similar, like expect.

Version 1.00. ANSI C plus X11R6. Takes a keysym (with modifiers) on the command line, grabs that key, waits for it to be pressed, ungrabs it, and exits. I use it inside loops in scripts to implement “hot keys” (something that ought to be provided by olvwm, but isn't). I wrote Makefiles for Debian GNU/Linux, SunOS 5, FreeBSD, and HP-UX A.09.

Version 1.11. An Expect script that performs qwerty->Dvorak remapping. Has more features, and is more portable than, dvorak.c. The name “h.soav” is what you get when you type “dvorak” on a qwerty keyboard while pretending it's a Dvorak keyboard, which makes this script easy to invoke for those of us who have forgotten how to type in qwerty. See also dvorak-to-qwerty.

Version 1.00. ANSI C. Converts a text (hex) input stream to a binary output stream. Works well with binhex.c.

Version 1.00. A Bourne shell script that converts its argument, an IP address, to a name by calling nslookup. Known to work under SunOS 4, SunOS 5, and NeXTSTEP 3. This has been made obsolete by newer versions of nslookup that allow IP addresses to be looked up directly. iptoname.1 is the man page (nroff).

Version 1.0.1. ANSI C plus POSIX. A wrapper around the link() system call. This command exists in UNIX, but is usually restricted to the super-user.

Version 1.30.3. A Bourne shell script that mostly replaces the Solaris 2.[23] catman command, which had several problems. I don't know whether any of the problems still exist in Solaris 2.6. Version 1.30.1 is better tested, but the newer version should be less dependent on Solaris-isms in make and more robust to strange filenames.

Version 1.11. A Bourne shell script that can be put in the old place of a command that has moved, to notify users of the new location. If another command with the same name is already in the user's PATH, the script calls it transparently. The script should be removed after a while, once everyone who needs to see the message has had time to see it.

Version 1.0.2. A Bourne shell script that uses mp3info, mpg123, and sox to convert MP3 files to various other audio formats.

Version 1.0.0. ANSI C plus Single UNIX v2. Opposite of nice. Just like nice, except that the default increment is negative (meaning the process will get more CPU). Must be installed setuid root, but gives up its privileges before calling exec(). Should be executable only by group naughty.

Version 1.0.1. ANSI C plus X11. Prints the titles and URLs of all netscape windows. This is a trivial modification of a pre-release version of remote.c by Jamie Zawinski.

Version 0.1.1. A Bourne shell script that paginates a text file. Depends on awk.

Version 1.0.1. A Bourne shell script that uses the netpbm utilities to scale up an image by an integer factor using linear interpolation.

Version 0.1.0. A Bourne shell script that uses the netpbm utilities to convert a color image to grayscale. Whereas ppmtopgm computes luma, ppmtogray computes luminance, which is what you really want.

ppmuncomposite & uncomposite-raw.c
ppmuncomposite version 0.0.1 (Bourne shell script) depends on uncomposite-raw.c version 0.0.1 (ANSI C). Given two versions of an image, one pre-composited against a black background and one pre-composited against a white background, reverse-engineers an image with an alpha channel suitable for compositing against any background. As a demonstration, make-png-google-logo version 0.1.0 is a Bourne shell script that fetches the official on-black and on-white versions of Google's logo “sticker” GIF images and produces a transparent PNG image (which may not, I think, be distributed or used publicly without special permission from Google).

Version 1.00. Execs its first argument (passing any other arguments) from a child process for which all connections to the parent process have been severed.

Version 2.2.0. A 76-character (can anyone beat that?) 100% portable C89 (ANSI C) self-replicating program (it outputs itself). It does not assume ASCII, ends with a newline, and does not use printf without a prototype (it uses puts instead). See also the Quine Page.
Version A1.27. A sendmail configuration file that should let an internet host send mail directly to any internet address, without having to go through a mail host. Known to work under SunOS 4, SunOS 5, and NeXTSTEP 3. This is a “level 1” configuration file, meaning that it uses none of the features introduced in sendmail versions greater than 5. I no longer recommend this; go check out the sendmail site or the exim site instead.

Version 1.0.2. Bourne shell code that allows C header files to be included. Zero-argument #define symbols become shell variables. Depends on cpp and awk.

Version 1.4.7. A Bourne shell script that converts windows-1252 characters 128 through 159 to their nearest ASCII approximations, then invokes your pager. Depends on nawk, tty, and sometimes xterm.

Version 1.00. ANSI C. Copies the input to the output, inserting NULLs before each character. Useful for viewing ANSI animations on fast terminals.

Version 0.2.1. ANSI C. “Hard” stereo recordings, where some instruments or vocals are entirely on one channel, can be very uncomfortable to listen to using headphones. This filter adds a delayed attenuated copy of each channel to the opposite channel, removing the discomfort while preserving the illusion that those sounds are entirely on one side.

This small mish-mash of code has no version control. It's been touched by many people, lastly myself on Sat 8 Feb 1997. ANSI C. It's like uudecode, but ignores garbage.

Version 1.04. ANSI C plus POSIX. Asks the terminal what size it is, informs the tty, and resets the margins to the full screen. Useful under SunOS 4 because the vt100 termcap entry initializes the terminal with a bottom margin at line 24. Useful with telnet connections under any OS, because telnet, unlike rlogin, does not propagate window size. Also works with xterm, and probably a few other terminals.

Version 1.10. Tells what type of keyboard is attached to a Sun running SunOS 4 or 5. whichkbd.1 is the man page (nroff).

Version amc-1.0.2. A Bourne shell script that uses the Linux tc command and HTB queueing discipline to reduce network latency. Derived from Debian's modification of wondershaper version 1.1.

Version 1.4.1. A Tcl/Tk script that allows copy/paste of text across X displays without trust.

Version 5.8-amc4. A modification of the X11R6 xrsh script. PATH and DISPLAY are handled better, quoting in the remote command is easier, and the icon name is shorter. Version 5.8-amc3-draft1 is older and still has a few extremely minor bugs, but has been more thoroughly tested than 5.8-amc4.

[AMC]  Prepared by Adam M. Costello
 Last modified: 2017-Jan-01-Sun 19:56:47 GMT
[Any Browser]