~bin/
things in my bin
Thu May 7 21:55:50 2009

Made this little wrapper around the delightful automeme service for easy spamming with irssi. I have /meme aliased to /exec -o meme and it annoys the hell out of esch.

#!/bin/sh
# topical memes
# example:
#  ~$ meme poop lol
#  BITCHES DON'T LOL ABOUT MY POOP
# prefix
#  ~$ meme -p "twit @esch" poop lol
#  twit @esch ceiling h4x0r is poop you lol

[ "$1" = "-p" ] && {
 PREFIX="$2 "
 shift 2
}

URL="meme.boxofjunk.ws/moar.txt?lines=1"

curl -s $URL | awk -v m="$*" -v prefix="$PREFIX" '
 BEGIN { split(m, a, " ") }
 {
  for( x in a ) $(int(NF * rand()) + 1) = a[x]
  print prefix tolower($0)
 } 
'