Skip to content

Instantly share code, notes, and snippets.

@stesh
Created January 14, 2013 23:30
Show Gist options
  • Select an option

  • Save stesh/4534538 to your computer and use it in GitHub Desktop.

Select an option

Save stesh/4534538 to your computer and use it in GitHub Desktop.
#!/bin/sh
cd "$HOME/tmp"
ln -s $$ lock || exit 1
TMPDOT="$HOME/tmp/tmp.dot.$$.$RANDOM"
OUTPNG="/srv/webspace/stesh/intersocs.svg"
IRCLINKS="$HOME/bin/irclinks"
[ -x $IRCLINKS ] || exit 1
python "$IRCLINKS" irc.netsoc.tcd.ie "$TMPDOT"
NOW=$(date)
nice -n 19 dot "$TMPDOT" -Tsvg > "$OUTPNG"
chmod 644 "$OUTPNG"
rm "$TMPDOT"
TITLE="State of the Intersocs IRC network at $NOW"
OUTHTML="/srv/webspace/stesh/intersocs.html"
cat > $OUTHTML <<EOF
<!DOCTYPE html>
<html>
<head>
<title>$TITLE</title>
<style type="text/css">body{text-align:center;}</style>
</head>
<body>
<h1>$TITLE</h1>
<img src="$(basename $OUTPNG)" alt="$TITLE"/>
<p>Made possible by <a href="https://github.com/stedolan/irclinks">irclinks</a>, by
<a href="http://mu.netsoc.ie">mu</a>
</body>
</html>
EOF
chmod 644 "$OUTHTML"
rm lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment