Skip to content

Instantly share code, notes, and snippets.

@RussellSenior
RussellSenior / iowa-data.sh
Last active February 6, 2020 01:46
Iowa Caucus results scraping script
curl https://results.thecaucuses.org/ | sed 's|<|\n<|g' | tail -n +540 | grep -v '</li>' | sed 's|<li>||' | sed 's|<div class="wrap">|COUNTY |' | awk '$1 ~ /COUNTY/ { county=$0 } $0 ~ /<ul>/ { pline = NR } NR == (pline + 1) { printf("%s\t%s",county,$0) } pline && NR > (pline + 1) && $0 !~ /<\/ul>/ { printf("\t%s",$0) } $0 ~ /<\/ul>/ { printf("\n") ; pline=0 }' | awk 'NF > 0' | sort
(function() {
return {name: "russelltemp"}
})
function go(msg){
if (msg.method == "irc.privmsg") {
var epoch_match = /^!russelltemp(\s+(\S+))$/.exec(msg.params.message)
if(epoch_match) {
var sensor_id = epoch_match[2]
var rows = russelltemp(sensor_id)
@RussellSenior
RussellSenior / insert-temps.sh
Created August 1, 2017 01:12
exporting temperature data from beagle bone black
#!/bin/bash
bus=$1
while true ; do
slaves=$(cat /sys/bus/w1/devices/w1_bus_master${bus}/w1_master_slaves | sed 's/^not found.//')
if [ -z "${slaves}" ] ; then
echo -- bus ${bus} empty, sleeping
sleep 1;
else

Keybase proof

I hereby claim:

  • I am RussellSenior on github.
  • I am rssenior (https://keybase.io/rssenior) on keybase.
  • I have a public key whose fingerprint is 19D7 7D1D 4947 2808 AD57 2698 8C67 0714 F148 04AD

To claim this, I am signing this object: