Skip to content

Instantly share code, notes, and snippets.

@mynameisfiber
Created July 25, 2012 18:40
Show Gist options
  • Save mynameisfiber/3177797 to your computer and use it in GitHub Desktop.
Save mynameisfiber/3177797 to your computer and use it in GitHub Desktop.
irc to pubsub
#!/bin/bash
# Publishes IRC messages from a particular channel to a pubsub
server="irc.wikimedia.org"
channel="#en.wikipedia"
pubsub="http://localhost:8080/pub"
( echo "USER irc2ps * * :irc2ps_bot
NICK irc2ps$RANDOM
JOIN $channel"; cat -) | nc $server 6667 |
grep "PRIVMSG $channel"
while read LINE; do
echo $LINE | curl -d @- -s "$pubsub" > /dev/null;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment