Michael Rutter's Random Programs Page
This page collects together various bit of code I have written and installed in TCM, and after which people sometimes ask with a view to installing them elsewhere. The TCM Group is/was responsible for much bigger and better academic software packages, such as Casino, CASTEP, ONETEP and others.
There is no warranty or statement of fitness for purpose associated with any of the code on this page. If you wish to use them, it is up to you to determine whether they are fit for the purpose you have in mind. Most of them are unmaintained. None of them is in any way endorsed by this University. No guarantees of support are offered either.
The larger bits of code on this page are offered under the GPL, and clearly state this. The smaller pieces are so small as to be, in my opinion, unworthy of any restrictive licence. If the GPL is unsuitable for the use you wish, note that the author retains full rights to the code, so it may be possible to negotiate different terms with him.
Converts from pnm/bmp/gif/jpeg/png to eps/ps/pdf. Major features are that jpegs are converted without decompressing and recompressing, that stdin is accepted for input for all file types, and that some effort is made to make the resulting eps as small as possible. Originally designed for use with LaTeX, it has many other applications. Has its own download page. Part of its code was reused in the excellent PyXPlot.
This is a converter for CASTEP's check files, and can extract charge and spin density, wavefuctions, or simply atomic positions. It can also build supercells. For more information see the c2x website.
Linpack in Various Languages
A page dedicated to the Linpack benchmark in various languages: Java, Matlab, Octave, Numpy, Fortran, C, C++/eigen.
OpenMP parallelisation of the Linear Congruential RNG
It is unclear why one would wish to parallelise the Linear Congruential pseudorandom number generator, but the theory is interesting. Examples in C and Fortran, with OpenMP, given.
An example of using the hardware event counters on Intel processors to report the average mflops achieved by a program. As described, the code is part way between a utility and an example. Recently (2018) revised to work with Skylake, Kaby Lake and Xeon Scalable CPUs, also works with Core 2, Nehalem, Sandy Bridge and Ivy Bridge.
Major in the sense of being quite a few lines of code, but not of any finished quality. This demonstration code converts directly from XFig's .fig file format to PDF, without going via PostScript and gs. In its current form, of niche use.
Small Graphics Utilities
(If downloading these, do choose "download target" rather than attempting to copy and paste from your browser window. The latter is very likely to upset things.)
- duplex adds a PostScript header to a file to turn on duplex unit, then prints using lpr.
- eps2gif an eps to gif/png/pnm/jpeg converter. Needs ghostscript, cjpeg and pnmtools, which you probably have already. Also works with single-page PostScript files. Will perform anti-aliasing, and png+alpha output.
- psimages extracts (some) bitmaps from an eps or PostScript file, and saves them as pngs and jpegs. Requires ghostscript A companion to the excellent pdfimages from xpdf? (Now updated to version 0.7, which can write the first image found to stdout, and also with its own man page, for those who like such things: psimages.1)
Reading Exchange ical attachments with pine/alpine
Trying to decode Microsoft Exchange calendar invitations on older email clients can be painful. I use a line in /etc/mailcap of
text/calendar; vcal %s; copiousoutput;
And vcal is a python 3 script (download) which uses the widely-available icalendar module to decode the attachment.
This code has not been written to be robust in the face of all possible input: no warranty and use at your own risk!
Small Miscellaneous Things
(If downloading these, do choose "download target" rather than attempting to copy and paste from your browser window. The latter is pretty certain to upset things.)
- accton.c a simpler form of accton (Linux)
- check72 check fixed format FORTRAN source for lines of more than 72 characters using awk
- dos2unix a trivial DOS to UNIX text file converter using sed.
- epsi2eps.c extract a standard EPS file from Adobe's DOS-based EPSI format.
- errno a broken errno for broken GLIBC 2.2 apps.
- f2f90 a fixed to free format FORTRAN converter using sed.
- locktest.c test whether file can be locked with flock/lockf/fcntl
- pmap.c a program similar to Solaris's pmap to demonstrate the use of /proc on Tru64. Also a man page: pmap.1
- rpm2dir.c extract some of the contents of an RPM file (Linux package) into a directory. Intended for use on non rpm-supporting systems. Has no dependencies.
- unix2dos a trivial UNIX to DOS text file converter using sed.
- xbpp.c print depth of current X11 display
- Wrapping shared libraries (under Linux)
- Notes on gfortran (array bounds checking and module versioning)
- 64 bit inode numbers (and trouble with old 32 bit applications)
- Notes on QEMU/KVM including ethernet paravirtualisation
- Examples of sorts in Fortran
- Using ptrace to kill a process so that a zero exit code is returned