Utilities and Programs by M. Väth
This page contains some of the programs and utilities which I have written.
Some of them are about 20 years old, but others are rather new.
Most of the programs and utilities which used to be on this page are
now maintained as Git repositories on GitHub.
Note that even if you do not have git you can download the corresponding
tarballs on GitHub by choosing the "Tags" for the required revision.
As a reminder, this pages also lists the projects which can now
be found in GitHub.
The license for the packages on GitHub is listed in the packages.
For the other packages on this page there is the following ad-hoc license
(which I might change for a particular package if you ask me):
You may download and modify these programs for your private use.
If you make an interesting modification, I ask you to mail me a copy.
You may also distribute these programs unmodified
in any form you like.
If you want to use them in a commercial environment, or if you
want to distribute a modified version, please contact me.
Last changes: February 4, 2012
- Download page:
Some .spec files for SuSE 9.2
(last update: December 6, 2004).
- Download page:
Some scripts for Gentoo
(last update: January 7, 2012).
- Download page:
Packages for TeX and LaTeX
(last update: June 24, 2010).
- Download page:
Magus for SuSE 9.2
(last update: January 7, 2006).
Since I switched to Gentoo, I do not update this anymore.
For Gentoo, you find ebuilds in my mv overlay.
- less-select-patch-436.tar.gz
(last update: July 22, 2009).
With this patch you can select files (or other content) interactively from
a list, using the less program. A perl script making use of this
feature and executing certain commands on the selected files is also provided.
The patches in this file work at least with less versions 371-436.
For Gentoo, there is an ebuild in my mv overlay
- pyrep.zip
(last update: February 6, 2001).
(Python regular expression).
A python variant of the perl script
plrep described below.
To adapt the colors to your taste and console, edit the strings in the
first few lines.
- mv_perl.zip
(last update: June 28, 2011).
A collection of some perl scripts and corresponding (experimental) zsh-completion.
- plrep v2.6
(Perl regular expression).
This script provides among a more user-friendly variant of the
well-known grep (with perl regular expressions)
a method to replace regular expression within the files.
Special features include interactive replacement, recursive directory handling,
colorized display (adaptable for various terminal colors since v2.1),
readable output also for mixed text/binary files (conversion to printable
characters, very luxury truncation of lines), and also interactive
replacement/grep of expressions across multiple lines
(experimental since v2.1).
With plrep --man you get a detailed help as a manpage (new since v2.1)
This script requires at least Perl 5
(together with some modules). If you really must use
Perl 4, you can use the scripts prep and
rrep below which together have almost the same functionality.
- patchdirs v1.10.
This script serves two purposes:
-
It allows to keep directory trees in sync for computers which have no
direct connection. On the one hand, it allows to (recursively) list files
together with their checksums (and dates, owners, modes). On the other hand,
it can use that information to reconstruct all file renamings/deletions/copies
(and owner, date, mode-changes) based on the checksum information.
Even circular renamings (like swappings of filenames) can be reconstructed.
Of course, this script requires a checksum utility which provides a
sufficiently strong checksum (by default, the perl Digest::MD5 module is used,
but not mandatory: other programs are also supported).
The new release finally supports also copies of files,
changes of directory names, and stores/restores symbolic links.
Since v1.3 a --follow-link option is available, too.
Since v1.7 some useful options for FAT options have been added like changing
to upper/lower case or adding/subtracting a time offset.
-
This script is able to look for double files (where duplicates are
recognized by equal checksums). Since checksum information can be stored,
this is particularly useful if frequently new files must be compared against
a given directory tree. (If you want more reliable information than only a
checksum comparison, use the double perl script of this collection).
This script requires at least
Perl 5 (with some modules).
- patchdirs-ls v1.3.
This is somewhat similar to patchdirs but can only reconstruct from
an "ls --recursive" output exclusively on the base of names. This is very
fast and requires no checksum module/program. However, circular renamings
can of course not be recognized.
This script is still in experimental state. It requires at least
Perl 5 (with elementary modules).
- rendirs v5.3.
The "very standard" ISO9660 CD-Rom format only allows names of 8+3 characters.
If there are some reasons to use this format with non-packaged files, it is
often convenient to create additionally a list containing the original
filenames (and perhaps with a small description of the files). This script
renames the files corresponding to such a list. It also allows appropriate
creation/modification of symbolic links and treatment of empty "dummy" files.
Perl 5 (with elementary modules) is required.
- listcomm v1.1.
Print lines common to two list of file resp. contained in
only one of these lists. This is similar to the standard unix comm utility,
but deals with unsorted input/output.
Perl 5 (with elementary modules) is required.
- sshconfig v1.2. If you frequently ssh/scp/sftp/rsync to computers
with a dynamic IP address, you will find this script very useful.
It modifies/creates a ~/.ssh/config file for you such that you can
conveniently use the "real" hostname in your commands while the correct
IP address is used (enter the IP address only once for running the scipt).
From a security aspect, this script is what you should use in order to
associate the correct fingerprint to the host, even if its IP address
changes. This helps you to detect "man in the middle" attacks.
- prep v1.1 (Perl regular expression).
Similar to the well-known grep but with perl regular expressions and
possibility to recurse into subdirectories.
You should also have a look at the above script plrep.
- rrep v1.1 (Replace regular expression).
As prep above, but in addition, it is possible to replace the
regular expressions in the files (interactively or non-interactively).
Very flexible. You should also have a look at the script plrep.
- double v1.1. Looks for double files (the user may decide whether
equal names and/or equal content count as double).
Needs only O(n log(n)) comparisons in the mean.
See also the patchdirs script of this collection.
- renreg v1.2. Rename and/or number a set of files
using regular expressions.
- changecase v1.1. A very simple script which allows to change
filenames to upper or lower case (including directory names, recursively).
Very useful in connection with DOS partitions or archives.
- comp v1.2. Similar to diff -r -q, but compares also attributes,
time, owner, ... Also a usage like comp *.tex DIR is admissible.
- touch.difference v1.1. Correct times of files by a
daylight saving offset.
- touchdirs v1.2.
Touch directories according to their newest file.
- bzwc
(on GitHub since January 29, 2012).
This is a POSIX shell wrapper for wc which decompresses ".gz", ".bz2",
".lzma", or ".xz" files before sending them to wc.
All options of wc can be used, and as for usual wc,
it is possible to pass several files as arguments.
For standard input, the name of the command (bzwc, lzwc or zwc)
determines whether .bz2 .lzwc or .gz data is assumed.
A zsh completion file is provided.
The most convenient way to install this script for Gentoo is to use the
ebuild from the mv overlay.
- mv_emacs.zip
(last update: August 22, 2010).
A collection of some Emacs Lisp (.el) scripts which should run
with all newer versions of Emacs or XEmacs (Lucid Emacs).
- block.el (revision 1.3).
The standard Emacs treatment of the region is rather different from that
of many of the classical text editors. In many other editors a "block"
can be marked explicitly which exists independent of the current cursor
position and independent of the buffer. This package is an attempt
to emulate this behaviour by providing such a block and making it act
as if it were the region.
- kbdmacro.el (revision 0.3).
This package provides an intuitive way to define keyboard macros
(during runtime) and bind them to keys. The old meaning of the keys
is remembered and can be restored. It is also possible to save all
recorded macros into a file.
- verify.el (revision 0.2).
This package provides the single command verify which allows to
verify conveniently whether and where the buffer was actually
changed since its last "save".
- archwrap
(on GitHub since January 29, 2012).
A collection of some POSIX shell scripts which invoke various archivers
like (s)tar/bzip2/zip/... in an automized manner
(e.g. to invoke all archivers and keep only the smallest archive,
to unpack an arbitrary archive into some subdirectory, to repack archives,
to pack to remote host etc).
The most convenient way to install the archwrap scripts for Gentoo is to
use the ebuild from the mv overlay.
- looptool.zip
(last update: September 30, 2005).
A bash script to mount/unmount/encrypt/decrypt filesystems via the
loop device. Note that this script allows you to encrypt/decrypt
existing devices without using additional storage data.
Be aware that this makes use of an undocumented behaviour of encrypted
filesystems: Therefore this script might damage your data
(even if correctly used) if the undocumented behaviour of either the loop
device or of the encryption routine changes. It was only tested at some
occassions with twofish on SuSE 9.0 and with twofish256 on SuSE 9.2,
and I received no bug reports yet.
However, please use with extreme care!
In the new release, the default values are set for SuSE 9.2 - you must use
some flags if you want the previous behaviour.
- emount
(on GitHub since January 31, 2012).
A perl script to mount/unmount (and to create/remove) dm-crypt filesystems
according to your /etc/fstab.
The most convenient way to install this script for Gentoo is to use the
ebuild from the mv overlay.
- recovery.zip (Version 1.1)
(last update: June 28, 2011).
A small but very useful tool if one must use less reliable media like diskettes
to store/ship data: To a given file, it generates a small
recovery file which can be used to restore the given file after a
slight damage, e.g. after the loss of one block of information. (The maximal
size of such a block which still can be restored determines of course the size
of the recovery file). In contrast to other utilities, it is not
necessary to convert the original file into some special format: The original
file can be shipped unmodified, one just has to ship the small recovery file in
addition.
- hocp.zip
(last update: June 5, 2000).
This is an ancient program for calculation with arbitrary precision.
The archive contains a subdirectory calc_c in which there are
two C libraries for calculation of elementary resp. transcendental functions
with arbitrary precision. The main directory contains a Makefile which
generates the program hocp. This program provides an interactive
language to some of the library functions which is powerful enough to write
small programs. The language is an extension to the language hoc
which was described by Brian Kernighan and Rob Pike in their book
Der UNIX-Werkzeugkasten. All documentation is in German.
- calc.zip
(last update: June 5, 2000).
A C++ library for arbitrary precision. Also very ancient.
All documentation is in German.
- schach.zip
(last update: June 5, 2000).
A C library for chess. Extremely ancient, but I do not think I could write
a much better version even today. A simple demo program is provided which
solves all sort of chess problems, looking also for multiple solutions.
This demo program is not convenient to use. For the screen output of the
demo program some patches are necessary for UNIX. An executable for DOS
(with DJGPP) is included in the archive. All documentation is in German.
- quintris.zip
(last update: November 9, 2003).
Everybody knows Tetris. But this little game is different.
This .zip contains only a small executable for DOS and (new) for Linux
(it should run on all i386 linux systems but needs an 80x25 color terminal
to display well - I just crosscompiled without much porting).
This game was a very short project with my brother
many years ago to learn a new programming language.
- sshstart.zip (Version 2.6).
(last update: November 1, 2010).
A frontend for ssh-add and ssh-agent which asks you for the passphrase
automatically but only the first time you run ssh and friends.
The keychain script is supported if it is available
(a reasonable new version of that script is required).
Use sshstart -h to get a description.
- video.tar.gz (Version 4.4).
(last update: December 10, 2011).
A bash frontend for mplayer/mencoder and alsa to record movies from TV or
to re-encode them (possibly with several passes).
- sudox
(on GitHub since December 19, 2011).
This script is similar to
sux.
It is a wrapper for sudo which can transfer X authority data
(optionally generating "untrusted" permissions). In addition, some support for
screen and tmux is provided,
taking care of tty permissions.
For a description, use ./sudox -h or ./sudox -?.
A zsh completion file is also available.
The most convenient way to install this script for Gentoo is to use the
ebuild from the mv overlay.
- firewall
(on GitHub since February 2, 2012).
These POSIX scripts set some typical
iptables commands for a dialup PC,
optionally including a simple portknocking solution and router functionality.
The usage is somewhat similar to SuSEfirewall2, but the approach has
some essential differences. In particular, packets are usually not DROPed but
REJECTed until a rate-limit is reached. It is not necessary to restart the
firewall after a connection is established. The setting of the kernel variables
is done with a separate script. Currently, IPv6 is not supported by the script.
- starter
(on GitHub since January 30, 2012).
This script can be used to schedule commands in a multitasking and multiuser
environment. Commands started with this script will wait with the execution
until all earlier commands started earlier with this script (possibly by a
different user) have been executed. You can also have several of such
command queues or add a command to a queue even if you start it immediately.
There is also a wrapper script which may be used to queue shell-commands.
The archive contains also a corresponding (experimental) zsh completion file.
The most convenient way to install this script for Gentoo is to use the
ebuild from the mv overlay.
- diffhelp
(on GitHub since February 4, 2012).
A POSIX script acting as a frontend, beautifier, and path-fixer for diff -u.
- cpi
(on GitHub since February 3, 2012).
This is a somewhat verbose frontend for
cp -ia:
For each file you see the differences before you confirm/reject the copying.
- zram-init-2.tar.gz
(last update: February 8, 2011).
This is a small helper script to setup a zram device as swap or as a ramdisk
(linux 2.6.37 or newer is required).
An experimental zsh-completion file and Gentoo init-scripts are also provided.
This script can also installed from my mv overlay.
Visit Martin Väth's homepage