Feisty Meow Concerns Codebase Open Source Perl Scripts

Some Hopefully Useful GPL-Licensed Perl Code

Contributed by Chris Koeritz (Koeritz@Gruntose.COM)
See the GNU Public License for details of licensing.

Caveats:

  1. No warranty, express, implied or imagined, is offered for these files.  If you destroy your life by running one of them, I will have sympathy, but that's about it.
  2. Some of these shell scripts depend on environment variables.  The most frequent case of this is FEISTY_MEOW_DIR, which should point to the top-level directory where the Feisty Meow scripts are stored on your machine.   This variable is set by default when the scripts are in the ~/feisty_meow folder.  Consult your operating system documentation if you are unfamiliar with the concept or management of environment variables.
  3. These files are provided as possibly useful shell scripts rather than as full-fledged reusable and object oriented components.
  4. Improvements and contributions are gladly accepted.  They will be processed as fast as our schedule permits.  Please send any changes to the Gruntose Curator at fred@gruntose.com .
  5. These files are mostly portable between Unix and the various Windoze OSes, but in many cases you may want to fix the defaults or path names to make them more suitable for your own needs.
  6. Some of the scripts invoke external programs that are available for most Unixes.  For Windoze users, a set of GNU Unix utilities is available at "http://www.mingw.org/".
  7. An alternative, but not recommended, GNU suite is at "http://www.cygwin.com/".
  8. Direct Cognition: View the scripts directory itself rather than navigating with the links below: scripts.

 

Library Files

diff_lib.pl

The "differ" utilities can be used to compare two directories of text or binary files against each other.  The two directories are presumably close in contents.  This can be useful when one is revising a set of files and wants to synchronize an older copy against a newer version.  Support for "differ.pl" is provided here.

filename_helper.pl

Contains a handy set of utilities for manipulating filenames.  These can help to make perl scripts portable across the two well-known types of filename separators ('/' and '\').  They also provide support for ripping up filenames into their components.

inc_num.pl

This is a simple utility that manages a file with a number in it.  This is somewhat more useful than it sounds.  Functions are provided to get the current number and to change the number.

shared_snarfer.pl

This library supports the "snarf" utilities.  The utilities manipulate archive files with the ".snarf" extension.  These packed snarf files are compressed chunks of directory hierarchies.  Bob files are useful because they track a number per distinct "snarf" types that is used to make uniquely named new archives of the appropriate type.  This number is an ever increasing integer that's stored in a well-known (configurable) location.  When a snarf file is unpacked (using the "unsnarf" tool), the number is updated on the local machine so that the next generated file will be one greater than the previous number.  If one is travelling between two machines with the same snarf file, this will have the effect of keeping the number updated on both sides.

zap_the_dir.pl

Support for the zapdirs utility.  This library cleans out the directory that it is passed by removing files that are not considered important (using "filename_helper.pl ").  The list of important files is something you might want to look at to ensure that you won't get burned by zapdirs.

 

Applications

add_cr.pl

Processes Unix format text files for pcdos by forcing the line endings to be Carriage Return plus Line Feed (CRLF).

cgi_display.pl

Turns the files passed on the command line into a stream of CGI compatible text output. The javascript show_file method (see the source for this page) is preferred since it is lighter weight and doesn't need cgi, but there are some situations where cgi is the only option (older browsers or requirements of no javascript).

change_endings.pl

Replaces the suffix of all filenames in the current directory with a different suffix.  Suffix here is defined as the set of characters after the last period ('.') in the name.  Note this will not work for names without suffices.

cpdiff.pl

Copies files from a source directory into a destination directory.  The files are only copied when they are missing in the destination or when the destination version has different contents.  The syntax looks like this:
    cpdiff  source  destination
The assumption is that the files in the source directory are somehow better, newer or more complete than the set of files in the destination.

cpdiffnow.pl

Similar to cpdiff, but this utility sets the destination file's time stamp to "now".  This should cause the new or changed files in the destination directory to be more recent than anything else in there.  This is helpful sometimes for forcing compilation of modified source files.

cvs_fix.pl

Wraps the cygwin cvs command for pcdos/win32.  Any unfriendly backward slashes are flipped to be forward slashes.

differ.pl

Compares two directory hierarchies and the files they contain.  The first parameter is a directory to compare against "this" directory; every subdirectory "here" will be traversed in order to build the output file that shows the differences.  An optional second argument can be used to specify a different directory than the current one as the source of the comparison (the first argument is always the destination of the comparison).

filedump.pl

Collects the contents of the files whose names are passed on the command line into one gigundo stream which is passed to standard output. The output can be piped into another file as desired.

generate_aliases.pl

Performs some useful activities for the shell environment.  Using the environment variable for FEISTY_MEOW_SCRIPTS (which is set in the appropriate startup files to be the shell scripts directory, where all this stuff lives), generate_aliases will create all of the aliases files for the combinations of operating systems and types of shells supported.  Currently this includes Linux, Unix, PCDOS, OS/2 and MS-WIN32 (9x, NT, 2K, XP, etc) for supported operating systems.  The shell languages supported are dos's command, nt's cmd, unix's sh and bash, and perl.  This script will also look for any files ending in ".sh" or ".pl" and it will create aliases for them in forms appropriate to the different shells.  The .zz_auto_gen subdirectory is created under the home directory (or under TMP in DOS and Win32) as a storage place for the generated files.

goodbye.pl

A logout script for exiting from a shell; it prints a message using the nechung oracle for the user's benefit and starts a byejob before exiting. The byejob will wait for a few seconds, then clear the screen and print another fortune. It attempts to leave the screen looking like a standard login, but with an extra fortune.

new_sig.pl

Generates a signature file from the nechung database using the 'nechung' application.  See the Feisty Meow Concerns Codebase for the nechung application.  The database for nechung resides in the whole Feisty Meow Concerns code package in "feisty_meow/database".

renlower.pl

Renames all of the files passed on the command line such that they are only in lower-case.  Useful if you're tired of passing mistakenly re-capitalized names from a defective 8.3 OS (e.g. Doze95/98) to a file system where you care about the case.

runner.pl

Finds all executable files in the current directory (and subdirectories) and runs them.  The output of the programs is sent to standard output.  Standard error is used to report which file is being worked on, plus the running programs' own standard error streams are merged into runner's standard error stream.  This makes it nice to do something like:
       runner >runs.log
where the runs.log file will contain the output of each program that was executed and the console will be sent messages as each program is started and finished (and errors show up at the console also).

safedel.pl

Makes deleting files and directories a little less nerve-wracking.  If you substitute safedel as an alias for rm or del or deltree or whatever, it will make a zipped backup of the items before they are actually deleted.  Safedel keeps track of a number that is attached to each zip to enforce uniquely numbered archives.  They are stored in a directory named "zz_del_keep" that is stored under the temorary directory (specified by the environment variable named TMP).  A report of the contents of the compressed trash is appended to a file named "zz_safedel.rpt" in the TMP directory.  Occasional cleaning of the deleted files folder is recommend, but this utility has saved my various parts several times already.

snarf_linux_config.pl

A snarf utility that packages up the important configuration files in a Linux installation.

snarf_light.pl

A selective snarf of the source hierarchy.  This collects the code that I manage.  As such, this is probably irrelevant to anyone but CAK.

snarf_notes.pl

Gathers all "important" files from the home directory.  This is somewhat personally tuned but it includes files and directories that have "project", "notes", or "crucial" in their name.

snarf_src.pl

A source code grabbing snarfer.  The entire source code hierarchy is snarfed.  Note that one should edit the hierarchy location to make it appropriate for your local source code.

summing_dir.pl

Offers a directory listing along with total file sizes and disk free space.

synch_build.pl

This is a helper utility that synchronizes the binary outputs from a build process with an existing installed location.  Given a target directory, the executable programs and dynamic libraries that exist there will be synchronized with the build repository's versions.  This is kind of a quickie upgrade process, as long as the files in the target location are not locked by other processes.

unsnarf.pl

Uses the snarfer utilities to undo a previously snarfed file.  A folder named "snarf_BASE" is created for the contents, where BASE is replaced with the basename of the snarf file (that is, without the ".snarf" suffix).  The number that tracks the snarf files of this type is updated such that the next snarf file will be at least one higher than this snarf's sorta unique number.  The number will be managed correctly if you're always unsnarfing the most recent snarf files before creating any new snarfs.

whack_forever.pl

Since all of my file deletion commands are aliases to safedel, it is hard to actually remove a file.  If I'm really really sure that a file or directory needs to be permanently deleted, then this command can be used.  It shows the names it is removing also, but it does _not_ ask for confirmation.

y2038_check.pl

Tests the system for survival past the year 2038, which is when the Unix time scale runs out of bits for the number of seconds since 1970 measured in a 32 bit integer.

zapdirs.pl

Removes empty directories and directories containing only unimportant crud (see "filename_helper.pl").  If there are no arguments, then the current directory is cleaned up; any subdirectories will be traversed into and removed if it seems appropriate.  Otherwise, zapdirs operates on the arguments passed to it as if they are directory names to be cleaned.