Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am tserong on github.
  • I am tserong (https://keybase.io/tserong) on keybase.
  • I have a public key whose fingerprint is 9409 2010 12EC F0E3 F918 B284 DB7E 03BB B43C 2BA9

To claim this, I am signing this object:

@tserong
tserong / vote-analysis.rb
Last active December 22, 2015 19:39
Spit out the percentage of first preference votes a given political party got in the senate, by division.
#!/usr/bin/env ruby
#
# Go to http://vtr.aec.gov.au/SenateDownloadsMenu-17496-csv.htm and get
#
# * First Preferences by Division by Vote Type
# http://vtr.aec.gov.au/Downloads/SenateFirstPrefsByDivisionByVoteTypeDownload-17496.csv
#
# * Votes by Division
# http://vtr.aec.gov.au/Downloads/SenateVotesCountedByDivisionDownload-17496.csv
#
@tserong
tserong / node_is_active.sh
Last active December 19, 2015 22:19
Check if current node in a Pacemaker cluster is currently running any resources (new and improved thanks to lge on #linux-ha).
#!/bin/sh
[ -n "$(crm_mon -1 -n 2>/dev/null | sed -ne '/^Failed actions:/ q; /^Node '$(crm_node -n)':/,/^Node/ { /^Node/ d; p }')" ] \
&& echo 'this node is hosting resources' \
|| echo 'this node is slacking off, doing nothing'