Skip to content

Instantly share code, notes, and snippets.

View Elwell's full-sized avatar

Andrew Elwell Elwell

View GitHub Profile
@Elwell
Elwell / sample published info
Created February 20, 2016 05:20
Websockets Gauges
andrew@mythic:~$ mosquitto_sub -t 'sensors/+/json' -v
sensors/garage/json { "temp": 32.40, "humidity": 35.90 }
sensors/ESP-10264644/json { "temp": 24.1, "humidity": 56.8 }
sensors/garage/json { "temp": 32.50, "humidity": 36.00 }
sensors/ESP-10264644/json { "temp": 24.1, "humidity": 56.7 }
sensors/garage/json { "temp": 32.40, "humidity": 36.00 }
sensors/ESP-10264644/json { "temp": 24.1, "humidity": 56.5 }
sensors/garage/json { "temp": 32.40, "humidity": 36.10 }
sensors/ESP-10264644/json { "temp": 24.1, "humidity": 56.4 }
^C
@Elwell
Elwell / gist:6505599
Created September 10, 2013 06:14
mosquitto debugging
read_pv was failing when publishing (hangs after publish), so knocked up a dummy test client with static dictionary
andrew@guruplug:~$ ./debug_mqtt.py
{'AC_Hz': 2925, 'PV_A': 11, 'Out_W': 3428, 'PV_W': 3355, 'PV_V': 3014, 'kWh_Total': 1851, 'timestamp': 1378793395.40962, 'pid': 6573, 'kWh_today': 17, 'AC_V': 11}
loop start
^C
^C
^Z
[2]+ Stopped ./debug_mqtt.py
andrew@guruplug:~$ killall debug_mqtt.py
@Elwell
Elwell / gist:5663508
Created May 28, 2013 15:16
BDII query
ldapsearch -LLL -x -h localhost -p 2170 -b GLUE2GroupID=grid,o=glue '(&(objectClass=GLUE2ComputingShare)(GLUE2ComputingShareMaxCPUTime=999999999))' | perl -p00e 's/\r?\n //g' | grep dn: | cut -d"=" -f5 | cut -d"," -f1 | sort | uniq
@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;
@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 / 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 / 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
#!/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 / 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);
@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()
{