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 / 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
@mbainrot
mbainrot / Perl play youtube
Created January 28, 2014 10:26
Simple little script to automatically play a youtube file in debian
#!/usr/bin/perl
$videoId = "PhGtxxxorPk";
$url = "https://www.youtube.com/watch/?v=$videoId";
$playURL = "https://www.youtube.com/embed/$videoId?rel=0&autoplay=1";
# Remove temp file
`rm temp.html`;
# Fetch "video"
$cmd = "wget -O temp.html \"$url\"";