Tuesday, October 30, 2007

cowsay: a configurable talking and thinking cow

Today's Debian Package of the day Cowsay reminds me of a dull day few years back when I wrote this 'cowwords' script to amuse myself.Even a useless tool like cowsay can be interesting with creative use, CrunchBang has another cool hack using vrms and cowssay Happy Hacking! :) .

Cowsay is a useless but very fun text filter written in Perl. If you send some text into cowsay, you get an ASCII cow saying your text. For example, cowsay Hello, World! prints


_______________
< Hello, World! >
 ---------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


Script in public domain originally posted on FSUG-Bangalore Mailing-list

#!/bin/sh # # SCRIPT: cow-words.sh # AUTHOR: Rakesh 'arky' Ambati (http://www.linuxgazette.com/blog/4864) # DATE: 17 January 2005 # VERSION: you_must_be_kidding # # CREDITS: I Thank Karma_Police for the 'cow file randomizer code' # # PURPOSE: Retrieves the Dictionary.com 'Word of the Day" RSS Feed and # a random character teaches them. # # DEPENDS: 'xmlstarlet' # 'cowsay' # Both are available packages in Debian (Sid) repository. # To install them just type 'apt-get install xmlstarlet cowsay' # # # set -x # Uncomment this for debugging. # # ##################################### # Use 'cowsay -l' to the full list of cow files in your system # # (Sorry fellas I removed possible offensive 'sodomized*, head-in,telebears, # # kiss' cow files # ###################################### cows=(apt beavis.zen bong bud-frogs bunny cheese cower daemon default dragon dragon-and-cow elephant elephant-in-snake eyes flaming-sheep ghostbusters hellokitty kitty koala kosh luke-koala mech-and-cow meow milk moofasa moose mutilated ren satanic sheep skeleton small stegosaurus stimpy supermilker surgery three-eyes turkey turtle tux udder vader vader-koala www) random=RANDOM%44 ######################################### ## Get the XML feed and do the selection ## ######################################## /usr/bin/xmlstarlet sel --net -t -m "/rss/channel/item/description" -v "." "http://dictionary.reference.com/wordoftheday/wotd.rss" | /usr/bin/cowsay -n -f ${cows[random]} # End of the script

No comments:

Post a Comment

You can leave a comment here using your Google account, OpenID or as an anonymous user.

Popular Posts