No description, website, or topics provided.
Perl Shell Lua
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
countdir
counter
ctime2date
date2ctime
dgrep
greptype
hardwrap
lp2
my
myupdatedb
pdf2grayscale
prepend
random-line
repeat
rerun
retcode
retouch
reverse
sig
softwrap
thumbify
zcat

README.md

Miscellaneous utilities

Here are some utilities that I've written out of need. Several of them depend on each other or other common software; dependencies are noted below. Brief descriptions follow; precise documentation, where it exists, is in the programs themselves.

See the individual programs for their licenses; most of them are GPLed, while a couple of trivial ones are placed in the public domain.

The Lua scripts need the stdlib Lua libraries. In general, a POSIX system is assumed; there are likely to be unwitting dependencies on GNU extensions.

repeat (Perl)

Repeat a command a certain number of times.

retcode (sh)

Run a command and print its return code.

rerun (bash)

Run a command with a modified environment. Works with commands found on the PATH, and with session managers (when your session is restarted, the command will be run again with its modified environment). Useful for running programs with LD_PRELOAD.

retouch (Perl)

Perform a command, preserving the timestamp of a file.

my (Perl, sh)

Needs mlocate and GNU grep

Find a file in the user’s home directory. GNU grep is used for colour output when standard output is a terminal. Uses a database created by myupdatedb.

countdir (Perl)

Counts the number of non-dot files and directories in a directory.

greptype (sh)

Needs find

Grep files of a particular type.

dgrep (Perl)

Greps the default system dictionary, or that for the given language.

zcat (Perl)

Needs atool

Cat a possibly-compressed file (zcat only works on compressed files). Does not currently accept any of cat’s command-line options.

prepend (Perl)

Prepends standard input to the given files.

softwrap (Lua) and hardwrap (sh)

Soft and hard wrap text. hardwrap just uses fold.

reverse (sh)

Reverse a file byte-by-byte, using tac.

random-line (Perl)

Copies a random line from standard input to standard output.

sig (Perl)

A signature-with-random-tagline generator: it appends a random line from ~/.taglines to ~/.signature, formats the result nicely and prints it on standard output.

pdf2grayscale (sh)

Needs ImageMagick

Convert a PDF file to grayscale, to avoid wasting colour ink or toner when printing.

lp2 (Perl)

Print files two-sided on a one sided printer by printing the even and then the odd pages. It's set up to work sensibly on my printer (straight paper path, pages come out face down). It works with any file type that CUPS can print.

thumbify (Perl)

Needs Image::ExifTool

Add EXIF thumbnails to images. In practice, this seems to mean JPEGs and PNGs.

counter (Perl)

Maintains a counter in a file: each time counter is invoked the counter in the file is incremented and the new value output to standard output.

ctime2date and date2ctime (sh)

date2ctime is by Steve Kinzler

Convert between ctime and date strings.