Skip to content

Instantly share code, notes, and snippets.

View mbainrot's full-sized avatar

Max Bainrot mbainrot

  • Canberra, Australia
View GitHub Profile
@mbainrot
mbainrot / gist:ea9e31f14060a0a205f4
Created April 25, 2015 23:57
Creation for the power monitoring table
CREATE TABLE IF NOT EXISTS `tbldailytotal` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`meterid` int(11) NOT NULL,
`day` int(11) NOT NULL,
`month` int(11) NOT NULL,
`year` int(11) NOT NULL,
`hour` int(11) NOT NULL,
`minute` int(11) NOT NULL,
`start_ts` int(11) NOT NULL,
`end_ts` int(11) NOT NULL,
@mbainrot
mbainrot / etc init.d home_automation
Last active August 29, 2015 14:18
Make a python + virtualenv run as a service
#!/bin/sh
### BEGIN INIT INFO
# Provides:
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
@mbainrot
mbainrot / esp8266_homeautomation.lua
Created February 23, 2015 09:41
Work in progress script, having problems with debouncing and reliable triggering
m = mqtt.Client()
-- Configuration
host = "172.16.4.50"
port = 1883
queue = "/hello_8266"
bounceTimeout = 200
targetGpIO = 5
-- Internal Variables