Skip to content

Instantly share code, notes, and snippets.

View Elwell's full-sized avatar

Andrew Elwell Elwell

View GitHub Profile
@Elwell
Elwell / transmission-stats.py
Created January 27, 2012 15:14
Transmission statisics via RPC/json/python
#!/usr/bin/python
# ideas lifted from bash collectd Plugin to monitor transmission-daemon traffic
# Written by Yarek T, however that was old and didn't play nice :-)
# Andrew Elwell. Jan 2012
from urllib2 import Request, urlopen, URLError, HTTPError
import json
# see https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt
@Elwell
Elwell / mq_apc.py
Created February 9, 2012 16:16
apcaccess (APCupsd) to MQTT python script
#!/usr/bin/python
# Script to poll the UPS (via apcupsd) and publish interesting facts to
# MQTT.
# Published under GPL3+ by Andrew Elwell <Andrew.Elwell@gmail.com>
import subprocess
# we use mosquitto for the MQTT part
@Elwell
Elwell / apc2pacube.py
Created February 24, 2012 19:48
apcaccess (APCupsd) to Pachube python script
#!/usr/bin/python
# Script to poll the UPS (via apcupsd) and publish interesting facts to
# pachube. You'll need to alter FEED_ID and insert your API key
# Published under GPL3+ by Andrew Elwell <Andrew.Elwell@gmail.com>
import subprocess # we scrape apcaccess output
import requests # CBA writing a pachube library
@Elwell
Elwell / tagit.sh
Created March 5, 2012 14:06
Script to geotag single images from command line
#!/bin/sh
#
# Copyright (C) 2010 Alexander Heinlein
# This program is free software blah GNU GPL version 3+ blah.
#
set -e
decimal_to_sexagesimal()
{
@Elwell
Elwell / mqtt_publish.ino
Created April 23, 2012 12:36
test MQTT flood-publish (wanted as fast as poss sending)
#include <NanodeUNIO.h>
#include <NanodeUIP.h>
#include <NanodeMQTT.h>
NanodeMQTT mqtt(&uip);
struct timer my_timer;
void setup() {
byte macaddr[6];
NanodeUNIO unio(NANODE_MAC_DEVICE);
#!/usr/bin/python
# script to parse out the metadata from soma fm and send to mqtt
xmlurl = 'http://api.somafm.com/channels.xml'
from lxml import etree
tree = etree.parse(xmlurl)
interesting = ('title','description','image','twitter','listeners','dj')
@Elwell
Elwell / somaxml2mqtt.py
Created June 28, 2012 10:05
SomaFM -> MQTT
#!/usr/bin/python
# script to parse out the metadata from soma fm and send to mqtt
xmlurl = 'http://api.somafm.com/channels.xml'
mqtt_broker = 'nowplaying.elwell.org.uk'
import mosquitto
import collections
import time
@Elwell
Elwell / get_vk6.py
Last active December 14, 2015 19:29
Query to get VK6 callsigns from the ACMA
#!/usr/bin/python
# Script to gather callsigns from http://web.acma.gov.au/pls/radcom/register_search.search_dispatcher
import urllib2
import csv
from bs4 import BeautifulSoup
todo = None
base ='http://web.acma.gov.au'
@Elwell
Elwell / gist:5145625
Created March 12, 2013 18:37
Peering wierdness between AS24904 and AS13030
$ traceroute -a zurich.aprs2.net
traceroute to zurich.aprs2.net (213.144.138.93), 64 hops max, 52 byte packets
1 [AS28513] router (192.168.1.1) 1.596 ms 0.908 ms 0.774 ms
2 [AS24904] border1-sgp.kwaoo.net (178.250.215.254) 1.491 ms 1.817 ms 1.612 ms
3 [AS24904] border1-cixp.kwaoo.net (178.250.208.6) 1.733 ms 1.857 ms 1.636 ms
4 [AS513] cixp.init7.net (192.65.185.193) 6.125 ms 2.067 ms 12.666 ms
5 [AS13030] r1qls1.core.init7.net (77.109.128.65) 2.762 ms 2.529 ms 13.410 ms
6 [AS13030] r1ber1.core.init7.net (77.109.128.181) 3.754 ms 3.736 ms 3.861 ms
7 [AS13030] r1zba1.core.init7.net (77.109.128.173) 6.119 ms 12.326 ms 4.891 ms
8 [AS13030] r1zlz1.core.init7.net (77.109.128.229) 4.996 ms 5.397 ms 13.835 ms
@Elwell
Elwell / ow_parsename.c.patch
Created May 8, 2013 14:42
bugfix for owfs
diff -u -r1.220 ow_parsename.c
--- ../../..//owlib/src/c/ow_parsename.c 24 Jul 2012 01:47:31 -0000 1.220
+++ ../../..//owlib/src/c/ow_parsename.c 8 May 2013 14:39:46 -0000
@@ -343,11 +343,11 @@
return parse_nonreal;
} else if (strcasecmp(pathnow, "text") == 0) {
- pn->state |= ePS_json;
+ pn->state |= ePS_text;
return parse_first;