© 2009 Mitch Richling
Linked below you will find a few software tools I have written over the years. Most of them are UNIX centric, but are intended for UNIX users. You can find a few more tools intended for UNIX system administrators here. You may also be interested in some of the code on may Programming Examples page as well.
I frequently encounter bits of LaTeX code in e-mails, comments in source code, and journal article titles on the web. While most are simple enough to decode in my head, many are complex enough that a little software assistance is more than welcome. The script latexit.rb takes little bits of LaTeX code, renders a high quality preview, and pops up the result on the screen. It can do this from the command line (processing its arguments or standard input), and so may easily be integrated with other software. I have integrated it with my e-mail client, my editor, and into a generic GUI.
I use
GNU Emacs)
as my editor. I wanted to be able to highlight a bit of LaTeX, and hit a button to see it rendered. The wonderful
thing about Emacs is that it really is a fully programmable editor. Integrating
latexit.rb
with Emacs was easy. I added the following to my .emacs:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun MJR-latexit()
"This function runs latex on the highlighted region, and displays the result.
Use the latexit.rb script in my home directory -- handy to have inside of Emacs..."
(interactive)
(let* ((reg-min (if (mark) (min (point) (mark)) (point-min)))
(reg-max (if (mark) (max (point) (mark)) (point-max))))
(if (file-exists-p "~/bin/latexit.rb")
(shell-command-on-region reg-min reg-max "~/bin/latexit.rb -")
(message "MJR: MJR-latexit: ERROR: Could not find the latexit.rb command!"))))
I also integrated latexit.rb into a little GUI that I pop up right beside my browser window when browsing journal indexes on the web. The GUI is written in Ruby version 1.9.1. The code for the GUI is linked below: latexitGUI.rb
I sometimes find myself on a platform without od or hexdump, so I keep my own little
hexDump.rb
ruby script on my thumb drive. It produces a "canonical" hex dump of whatever data you give it. The format is quite
wide and uses terminal colors to denote non-printable characters -- I generally use quite large,
color xterms.
LaTeX and TeX create a great number of temporary files that can seriously clutter up your hard drive. This little
script,
nuke_tex.sh,
finds and deletes these temporary files in a relatively save way -- note that I did not say
"complete safe", I said "relatively safe". The algorithm used is to find .tex files, and then delete
files in the same directory with the same base name and an extension typically associated with temporary TeX
files. The only exception is directories named 'auto' -- they get deleted if any .tex file
is fond in the same directory -- these auto directories get created by Emacs.
mpmfs.rb is a ruby script that implements a file-server (with a few extra bits) as a web service (a specialized HTTP server) using Ruby. Some of the things it can do:
Normally MPMFS is bound to the host's loop-back interface (localhost or 127.0.0.1) so that it may be accessed by any local processes. If the local host is shared with other users, then HTTP authentication should be used to prevent access. To access a MPMFS server from a remote host, an SSH tunnel is the usual solution. An alternate way of accessing an MPMFS remotely is to bind it to an externally visible interface. When used in this way, it is probably a good idea to turn on both SSL and HTTP authentication. For the ultimately paranoid, using SSL, HTTP authentication and an SSH tunnel in combination may be just the ticket.
mpmws.rb
is a little ruby program that implements a simple web server providing browsable directory index lists, HTML index
support (index.html), and CGI support. While not as sophisticated as web servers like Apache, this web
server is more than adequate for testing things like CGI scripts client side AJAX-style code.
Making sure files transferred across the Internet arrived unharmed or that backups really contain faithful copies of the data they protect are both problems easily solved by checksums. The problem is that checksum tools are frequently difficult to compute, and once you have them they are difficult to use -- how, precisely do you compute checksum for an entire directory tree and then compare them all in an intelligible way? The tools listed below are intended to make the process of producing and consuming checksums easy.
mjrCSUM.sh is a shell script that takes a file name, and spits out some checksum information. Similarly, mjrCSUM.c.html is a C program that operates identically, but is several times faster than the shell script version. The C version in my multithreaded filesystem traversal tool suite is even faster than the one listed on this page, but it is much more difficult to get up and running for most people. csumf.sh is a simple shell script that can be used to drive one of the above two scripts in order to compute checksums for an entire directory tree. cmpCSUM.rb is a ruby script that can compare two checksum files -- like the output produced by the scripts above.