Here you will find various random scripts that I have written of varying levels of usefulness. I find that I commonly write quick scripts that are needed for a particular purpose and then I lose them. As I write new scripts or find old ones that may have some utility to other people, I will try to place them here so that they can be found and used again.
Scripts that depend on specific programs may require the output to be formatted a specific way. They were all written on various versions of Linux. If a program changed it's output with a new version, then the script will need to be updated. If you are using a BSD variant or a commercial Unix, changes may need to be made to some of these scripts to make them function.
If you have questions regarding any of these scripts please go to the forums.
WARNING: Most of these scripts are not meant to be quality code. They are simply meant to get a job done. Some of them can be dangerous to use. Please understand that any usage is at your own risk.
- aping - Audible ping
- diffgrep - Search diff files
- gwf - Get Web Files
- killgrep - Kill all processes matching a regex
- killtree - Kill a process and all children
- pstack-gdb - A pstack like utility
- unique_words - Count unique words
- witty - Programmatic wit generator
- expectbot - IRC command wrapping bot
- photo_page - Simple HTML image gallery maker
aping
This was a quick attempt to make an audible ping where the pitch varies based on the latency.
LICENSE: BSD
LAST UPDATED: Unknown
LANGUAGE: Perl
DEPENDENCIES: Audio::DSP, ping
diffgrep
A very sloppy hack that lets you use a regex to search through a diff file and only display sections that match. On very large diff files this sometimes comes in handy. By default it does use colors in the output, but it just prints a raw escape code rather than properly looking at the termcap.
LICENSE: BSD
LAST UPDATED: Unknown
LANGUAGE: Perl
DEPENDENCIES: None
gwf
Get web files. This script allows you to specify a regex and download all files matching that. For example:
gwf '\.pdf$' http://example.com/documents
That would download all pdf files found on the site. This is sloppy and there probably is a better way to do this using just wget options.
LICENSE: BSD
LAST UPDATED: Unknown
LANGUAGE: Perl
DEPENDENCIES: wget
killgrep
This is fairly similar to pkill, except it has a lot less options. I was bothered that pkill didn't have an option to list the processes that were sent signals. That was a while ago, and that option may exist now. This script is fairly dangerous.
LICENSE: BSD
LAST UPDATED: Unknown
LANGUAGE: Perl
DEPENDENCIES: ps
killtree
This script is a bad idea. For arguments it takes a list of PIDs and then it scrapes the pstree output and kill -9's every PID and all of it's children. This was written when I was dealing with a program that would commonly abandon tons of zombie child processes. While it did the trick, generally using this is probably a bad idea. Careful with this one, and don't pass it PID 1 when running as root.
LICENSE: BSD
LAST UPDATED: Unknown
LANGUAGE: Perl
DEPENDENCIES: pstree
pstack-gdb
This prints a stack trace of a running process. Apparently there is now a linux program called pstack, and you are probably better off using that one. Back when I wrote this I couldn't find any such program, and so I made this very hackish script that scraped the stack out of gdb. This is written to work on Linux with 2.4 or 2.6 kernels, but porting beyond that to any system with GDB should not be much of an ordeal.
LICENSE: BSD
LAST UPDATED: Unknown
LANGUAGE: Perl
DEPENDENCIES: gdb, ps, pstree, /proc, ls, stty, cat
unique_words
This script counts up a list of unique words found in the input text files and then outputs a list of each word along with the number of times that it occurred. The output list is sorted alphabetically by the words. If you would prefer it numerically by number of occurrences, try piping it through something like "sort -n -k 2".
LICENSE: BSD
LAST UPDATED: Unknown
LANGUAGE: Perl
DEPENDENCIES: None
witty
Inspired by Freud's "Wit and Its Relation to the Unconscious," this program takes a word-list and based on provided rules finds words that can be put together to create exciting new words. For example, if you take the word "geocentric" and the word "trickery" you get the new word "geocentrickery."
LICENSE: BSD
LAST UPDATED: November 15, 2007
LANGUAGE: Perl
DEPENDENCIES: None
expectbot
This is an IRC Bot that makes any line based program accessible through IRC. For example, you can run the bsd-games monop program and then everyone in the channel will see the output of the command and all their messages will work as input. This will allow them to play a game of monopoly on IRC (assuming they are nice and wait their turns.) There is no security! Any user can run any command (including a shell,) so this should not be run on public channels or around anyone that you wouldn't want to have full access to the account it is running as. You probably shouldn't run this as root.
In IRC:
!exec [cmd] [args...] - change the running program to a new one
!ctrl [char] - send a control character to the running program
LICENSE: BSD
LAST UPDATED: Unknown
LANGUAGE: Perl
DEPENDENCIES: Net::IRC, Expect (Perl modules)
photo_page
A quick script written to take a directory of photos (such as those taken off of a digital camera) and create thumbnails and an index.html so that the pictures can easily be browsed and viewed.
LICENSE: BSD
LAST UPDATED: April 22, 2010
LANGUAGE: Perl
DEPENDENCIES: ImageMagick's convert command must be in the path