Skip to content

Instantly share code, notes, and snippets.

@tdack
tdack / SharpIR.py
Last active Aug 29, 2015
Python object for Sharp 2Y0A21 InfraRed distance sensor (and similar). Includes calibration routine to calculate the coefficient and power for the distance equation
View SharpIR.py
#!/usr/bin/python
import Adafruit_BBIO.ADC as ADC
from time import sleep
import sys
#
# For the BeagleBone Black the input voltage has to be 0-1.8V
# The easiest way is with a voltage divider
#
# Ra Rb
@tdack
tdack / lcdui.py
Last active Aug 29, 2015 — forked from ufux/lcdui.py
View lcdui.py
import smbus
import getopt
import sys
from time import *
from time import gmtime, strftime
# TODO: Factor out all device_write calls to some PCF8574 specific module ...
# will be different with another io expander
# communication from expander to display: high nibble first, then low nibble
@tdack
tdack / README.md
Last active Aug 29, 2015
Apache MythWeb reverse proxy
View README.md

Apache reverse proxy configuration for MythWeb over HTTPS

@tdack
tdack / gist:59b1ff3a1eef77df7f79
Created Dec 17, 2014
MetricsGraphics test case
View gist:59b1ff3a1eef77df7f79
D1=[{"time":"2014-12-10T07:00:00.000Z","val":23963.329444444444},{"time":"2014-12-10T08:00:00.000Z","val":0},{"time":"2014-12-10T09:00:00.000Z","val":7350.143697764535},{"time":"2014-12-10T10:00:00.000Z","val":1230.5423714379733},{"time":"2014-12-10T11:00:00.000Z","val":2680.6423191974077},{"time":"2014-12-10T12:00:00.000Z","val":5110.947544547842},{"time":"2014-12-10T13:00:00.000Z","val":2972.8870586764733},{"time":"2014-12-10T14:00:00.000Z","val":14244.08293326015},{"time":"2014-12-10T15:00:00.000Z","val":4154.984313596681},{"time":"2014-12-10T16:00:00.000Z","val":21274.571393023052},{"time":"2014-12-10T17:00:00.000Z","val":12827.169734152581},{"time":"2014-12-10T18:00:00.000Z","val":767.7136190974885},{"time":"2014-12-10T19:00:00.000Z","val":2.654181912484959},{"time":"2014-12-10T20:00:00.000Z","val":1.4527777777777775},{"time":"2014-12-10T21:00:00.000Z","val":659.5492520499265},{"time":"2014-12-10T22:00:00.000Z","val":547.1229701722958},{"time":"2014-12-10T23:00:00.000Z","val":1.6424999999999998},{"time"
@tdack
tdack / rrd2D3.js
Created Feb 2, 2015
Output data from javascriptrrd for use with D3js
View rrd2D3.js
// return an array of objects containing D3elements, one per DS
//
// data = [
// {
// name: <DS name>,
// values: [{ date: <timestamp>, value: 1}, { date: <timestamp>, value: 2}]
// },
// {
// name: <DS name>,
// values: [{ date: <timestamp>, value: 1}, { date: <timestamp>, value: 2}]
View appswitch.pl
#!/usr/bin/perl -w
###############################################################################################################################
## Name: appswitch.pl
##
## Purpose: Executed by irexec this script will cycle between mythtv and kodi using a single button.
##
## (C)opyright 2008 Arksoft.
##
## Author: Arkay
##
@tdack
tdack / README.md
Last active Aug 29, 2015
Grab Bigpond usage using Python
View README.md

Telstra Bigpond Usage

A simple python script to grab the current usage from your Telstra Bigpond account.

Dependencies: python-requests
bs4

Change the username and password as appropriate

View pendulum.cpp
ofstream fSlots;
fSlots.open(SLOTS);
fSlots << "ADAFRUIT-UART2" << std::endl;
fSlots << "PyBBIO-epwmss0" << std::endl;
fSlots << "PyBBIO-eqep0" << std::endl;
fSlots << "PyBBIO-epwmss1" << std::endl;
fSlots << "PyBBIO-eqep1" << std::endl;
fSlots.close();
@tdack
tdack / README
Created Sep 27, 2012
XML -> HTML using XSL in PHP
View README
The parse-xml.php file uses the opf.xsl style sheet to read the book.opf XML file and output some minimal html for he description of the book.
The html produced is the contents of the <dc:description> tag surrounded by a <div>.
@tdack
tdack / date.php
Last active Dec 27, 2015
Simple php script to run a shell command on a server when a button is pressed and return the result.
View date.php
<?php
$output = array();
$retvar = "";
if ($_GET['run'])
{
// 2>&1 redirects STDERR to STDOUT
exec("/bin/date 2>&1", $output, $retvar);
}
?>
<html>