Miscellaneous Utilities

I've written a number of small utilities for my own use. Some of them may be useful to other people, so I'm listing them here. The documentation on these tends to be pretty minimal, although most support the --help option. Use at your own risk.

List of Utilities
License

These programs are free software; you can redistribute them and/or modify them under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. These programs are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

In addition to the GPL, the programs written in Perl may be distributed under the same terms as Perl itself.

eack - Run ack under Emacs

ack is a grep-like tool that has the power of Perl's regular expressions, plus recursive searches with smart file filtering. This is a little wrapper that makes it work better under Emacs’s grep mode. It adds the --nocolor and --nogroup arguments, and strips off the reference to /dev/null that Emacs likes to append.

eack r1964 (1k) (February 24, 2008)
Requires ack.

git-fix-svn-tags - Convert ‘tags’ created by git-svn into Git tags

I created this Perl script to convert the ‘tags’ created by git-svn (which seem to be more like branches) into actual Git tags. It hasn't had a lot of testing, so use at your own risk. Just run it in a Git working copy created by git-svn.

git-fix-svn-tags r2458 (2k) (November 3, 2010)
Requires the Git Perl binding, which is distributed with Git.

md5gz - Run md5sum on compressed files

This Bash script is like md5sum, but it runs files through zcat first, so you get a checksum of the uncompressed contents instead of the compressed version.

md5gz r506 (1k) (April 11, 2007)

mktime - Convert between UNIX times and human-readable dates

This is a tiny tool that just converts between UNIX epoch time and human readable dates. The argument is a single date, either a UNIX time value (in decimal or hex) or a human-readable date in any format supported by Time::ParseDate. The output is the date in hex, decimal, local time, and GMT.

$ mktime April 10, 2007 GMT
0x461AD380 => 1176163200 => Mon Apr  9 19:00:00 2007
                         => Tue Apr 10 00:00:00 2007 GMT

mktime r1756 (1k) (April 11, 2007)
Requires Time::ParseDate to convert from human-readable dates to UNIX times.

pmver - Print the version of a Perl module

This is a simple little tool that tells you what version of a module you have installed, and where the .pm file is located. It also ensures the module can be loaded successfully. It automatically converts ‘-’, ‘/’, or ‘\’ to ‘::’, so you can use a pathname or distribution name instead of the canonical module name. (Note: pmver used to be called perlver, but I renamed it due to a conflict with the perlver utility from Perl::MinimumVersion.)

Usage:  pmver [options] MODULE ...
  -e, --edit       Open MODULE.pm in your editor
  -p, --path-only  Display only the pathname (no version)
  -?, --help       Display this help message
      --version    Display version information

pmver r2537 (3k) (October 27, 2011)

svntag - Create tags in Subversion

I use Subversion as my main version control system. The standard way of tagging a particular version of a program is to copy /repos/trunk/project-dir to /repos/tags/project-dir/VERSION. But I couldn't find a tool to make that simple, especially if /repos/tags/project-dir doesn't exist yet. (svn copy will not create missing subdirectories.)

svntag takes care of that. Run it in the root of your project's working copy, and specify the TAGNAME you want to use. It will copy /repos/trunk/project-dir to /repos/tags/project-dir/TAGNAME, creating /repos/tags/project-dir if necessary.

Usage:  svntag [options] TAGNAME [PROJECT-URL]
  -r, --revision=REVNUM  Tag revision REVNUM (default HEAD)
  -?, --help             Display this help message
      --version          Display version information

The log message will be "Tagged MODULE TAGNAME (rREVNUM)".
MODULE is the directory's 'module-name' Subversion property,
or the directory name if the property isn't set.

svntag r1949 (3k) (February 11, 2008)
Requires the Subversion Perl bindings (SVN::Client).

Wild.pm - Wildcard expansion for Win32 Perl

The Windows cmd.exe shell doesn't expand wildcards. If you put “require Wild;” in your script, this module will take care of that.

Wild.pm (1k) (December 11, 2002)
Requires MSDOS::Attrib.

wren - Rename files with Perl regular expressions

Use the power of Perl's regular expressions to rename your files.

Usage:  wren [options] MATCH REPLACE file ...
        wren [-c | -d | -l | -u] file ...
  -F, --fixed-strings   Treat MATCH & REPLACE as fixed strings (not regexps)
  -e, --evaluate        Evaluate REPLACE as a Perl expression
  -i, --ignore-case     Use case insensitive matching
  -m, --multiple        Replace multiple occurrences in each filename
  -n, --just-print      Don't actually rename any files
  -c, --capitalize      Capitalize the first word of all filenames
  -d, --date-suffix     Append modification date to all filenames
  -s, --subversion      Use "svn rename"
  -l, --lowercase       Convert all filenames to lowercase
  -u, --uppercase       Convert all filenames to UPPERCASE
      --help            Display this help message
      --version         Display version information

wren r1752 (5k) (April 7, 2007)
Requires Wild.pm on Windows.
If you use 4NT, you should also install MSDOS::Descript.