Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

pronovic/old-utils

Repository files navigation

Old Utilities

These are old utility scripts, the oldest of which date to the late 1990s. They were originally hosted at software.cedar-solutions.com.

Many of these utilities are obsolete, either because of their language (i.e. Python 2), the system they interact with (i.e. the now-defunct Gallery v2 photo gallery), or the APIs they require (i.e. deprecated Google APIs). I am retaining them for historical reference, because even if they are obsolete they do sometimes represent a good example of how to accomplish a specific task.

See also: the vim-syntax repository, which includes Vim syntax files originally published alongside these utilities.

Note: this code is not maintained and there is no guarantee that any of it works properly any more. Make sure you understand what a script does before you try to use it.

Available Utilities

batchscan: Shell script to use SANE for scanning a batch of photographs. You need sane-utils and libtiff-tools installed.

change-string: Searches through a list of documents for a strings matching a Perl regular expression, and replaces the matching strings with a constant pattern. Useful when (for example) changing the copyright or author in all files in a given directory. Written in Perl 5.

c-stats: Acts on C or C++ source files and returns metrics related to the files. Returned metrics include overall lines, actual LOC (lines of code), number of comment-only lines and number of non-comment whitespace lines. Written in Perl 5.

dedup.py: Deduplicates a set of files, tossing the duplicates into a separate directory. Duplicate files are identified using an SHA256 secure hash. I have used this script to weed out duplicate photographs. Written in Python 2.

gallery-extract: Extracts Gallery (v1) albums into a directory and generates a printable index including captions. I used this when I want to put an album or albums onto a disc to show on a TV using someone's DVD player. It's tedious to copy the files by hand, so this script parses the Gallery data files, dumps the pictures into a directory, and renames them so the correct viewing order is obvious to the DVD player. Based on the script php-deserialize.pl by Bharat Mediratta. Written in Perl 5. Note: In early 2015, I discovered that this script is obsolete and no longer reads the serialized file format generated by the latest version of PHP.

gmailbackup: Wrapper around getmail to back up gmail via IMAP. Written in Python (requires 2.5 or better). Make sure you read the notes at the top of the script before using it.

gmailwhitelist: Generates an email address whitelist based on gmail data. The whitelist will contain email addresses from all of your "trusted" gmail contacts - the ones that show up under "My Contacts" in the gmail user interface. Written in Python (requires 2.5 or better), and uses Google's gdata Python library for connectivity.

kgrep: kgrep searches through a file or files for a specified pattern and displays the target line containing the pattern as well as a certain number of lines on either side of the target line. GNU grep does provide this functionality with its -A, -B and -C switches, and similar functionality may be available on some platform-specific grep implementations. The main advantage to kgrep is that it is small, and can be easily used on any system that has Perl5 installed, as an alternative to building and installing the GNU grep binary. Written in Perl 5.

muttsearch: Wraps grepmail in a way that is easily called from a Mutt macro. Only works on mbox files, not with maildir. Written in Python (requires 2.1 or better).

mutturl: This script provides a target for urlview. It searches out commonly-installed browsers on your system and provides you a list to choose from (the list varies depending on whether $DISPLAY is set, i.e. on whether you are running an X session). Written in Python (requires 2.1 or better).

photocopy: Makes greyscale photocopies to a printer using a SANE-enabled USB scanner. You will need to change the $PRINT variable to match the command-line for printing on your system. You may need to make other tweaks if you have more than one USB scanner. Your printer or print queue manager (i.e. CUPS) must support Postscript. Written in kshell.

py-stats: Acts on Python (*.py) source files and returns metrics related to the files. Returned metrics include overall lines, actual LOC (lines of code), number of comment-only lines and number of non-comment whitespace lines. Written in Python (requires 2.3 or better). Based in part on code by Leif K-Brooks, as documented in the code.

rcsinfo: Provides information about what files in a directory are checked out in RCS. The information is essentially a filtered and prettied-up version of the rlog output. Written in Perl 5.

reorder.py: Recurses through a directory and reorders all images by their EXIF creation date. Reordered images are written to a new target directory. This is useful if you have set of pictures taken by more than one camera, and you want to create a single cohesive image gallery. Written in Python 2.7 and requires PIL.

secret-santa: A "Secret Santa" exchange is one where a group of a people get together and each exchange gifts with one other person from that group. The exchange assignments are supposed to be secret, so that no one knows ahead of time who they will get their gift from. This script reads a configuration file and generates email assignments for a Secret Santa exchange. Written in Python (requires 2.5 or better). Also requires a local mail transfer agent (MTA) to send the notification emails.

span: Utility that "spans" (or partitions) the files in a directory into one or more sets of files, where the size of each set is as close as possible to a given capacity. When the spanning process is complete, the program writes the set definitions to disk to be used later. Four different knapsack algorithms (first-fit, best-fit, worst-fit and alternate-fit) are available to vary the method used to fit files into the sets. Written in Python (requires 2.1 or better).

whitelist: Processes one or more hand-maintained lists, Mutt-style addressbooks or mbox sent-mail folders and merges them into a single email whitelist. The whitelist will contain unique emails from among all chosen sources, including all To, CC and BCC emails from the messages in the sent mail folders. It is useful for mail processing using procmail, and some instructions are included. Written in Python (requires 2.4 or better) and also requires the formail utility.

xcf2png: Combination of a shell script and a Gimp script-fu script that converts Gimp XCF files (i.e. native Gimp files) to PNG format. Place the script-fu script in your ~/gimp/scripts directory before running the shell script. Based in part on a different script with the same name by Rik Hemsley, as documented in the code.

About

Old (and now mostly-obsolete) utilities originally hosted at software.cedar-solutions.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published