rfbooth.com :: tech :: Sigmonster: random quotage for mail and news
(Sigmonster is now at version 3: can return random quote containing given search terms rather than all; can return list of all quotes matching search terms, in quote file format. Version 2 added alternate tag and sig files, backtick interpretation.)
There comes a time in every self-respecting geek's life when he (or, sadly rarely, she) feels the need to have a different signature appended to every email and news post he produces. For me, that time came a while back, and the results of the coding frenzy have finally been sufficiently highly polished for me to post them here without feeling bad about it.
Sigmonster is a Perl script, and so you'll need Perl if you want to use it. If you're on Unix, this is not a problem.
It produces a signature every time it's invoked. You can do this by running the command
$ sigmonster
from the console, or attach it to a key sequence in your editor, or tell your mail or news clients to run it automatically. I use Jed for mail and news editing, and Mutt for mail; the addition of
set signature='sigmonster |'
to your .muttrc will give you sigs in Mutt, and adding
define sigmonster() { run_shell_cmd( "sigmonster" ) ; }
setkey ( "sigmonster", "^Cs" ) ;
to your .jedrc will give you a new sigquote every time you hit C-c s in Jed. (Incidentally, if you are using Jed and not mail_mode.sl, then you probably shouldn't be). If you give it arguments, it returns the first quote containing all of them, or nothing if it hasn't got one.
Sigmonster reads a random quote from .sigmonster/sigs. This file needs to be in BSD fortune file format, which means that the quotes should be separated by lines containing just a '%' character.
It also reads a tagline (which might contain email and homepage information, say) from .sigmonster/tags, which is also in fortune format. This goes above the quote, and the two are separated by the value of quotesep; this is empty by default, but some people like a blank line or what have you in between. A value can be specified in .sigmonster/rc.
The one exception to this is if the first line of the quote reads simply
NO ALTERATIONS
Then the quote (without that line) will be printed without using a tag or quotesep. This is mainly so that if you care about being McQ (no more than 4 lines, 80 characters per line) and have quotes that would otherwise be too long, you can still fit them in cunningly.
If you want to run multiple quotes or tags files, you can specify a different file on the command line:
sigmonster --tags more_tags --sigs more_sigs
If you'd like backtick interpretation within your quotes, so that
(say)
I'm running `uname -a`!
comes out as
I'm running Linux huxley 2.2.18pre21 #11 SMP Tue Aug 27 12:13:39 BST 2002 i686 unknown!
then add the word backticks
to the RC file.
The sigmonster itself is available here, and my current sigs, tags and rc files are also available to get you started, or just if you want to look at my quotes file. WARNING: the quotes file contains foul language and bad thoughts.
Many thanks to Mike Whitaker for the alternate sigs and tags files code, random/list options for searching, and general tidying, and David Cantrell for the backticks code.