Skip to content

Instantly share code, notes, and snippets.

tdack /
Last active Jul 20, 2022
Python object for Sharp 2Y0A21 InfraRed distance sensor (and similar). Includes calibration routine to calculate the coefficient and power for the distance equation
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 /
Last active Jan 15, 2022
Bridge Mosquitto MQTT broker to MQTT broker to use with
# Connection name
connection adafruit
# Secure SSL/TLS
# adjust path as approriate to point to directory with PEM encoded .crt CA files
bridge_capath /etc/ssl/certs/
# Insecure
tdack /
Created Jun 12, 2016
Custom handlebars helpers for Ghost, as an app
tdack /
Created Jan 12, 2016
Kivy custom properties on a widget
import kivy
from import App
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from import NumericProperty, ObjectProperty
import RPi.GPIO as GPIO
tdack /
Created Sep 12, 2012
Minecraft Overviewer dynamic config file
# Minecraft Overviewer dynamic config file for multiple Minecraft worlds
# managed by MSM (
import os
# Define where to put the output here.
outputdir = "/storage/www/vhosts/"
# Add Javascript to map when rendering
from observer import JSObserver
tdack /
Last active Jul 30, 2019
D3 graph from RRD data
tdack / browse.css
Created Nov 12, 2013
Tweaks to calibre-content server browse view. Displays book list as covers. Add the css rules as described and patch browse.html and browse.js in /usr/share/calibre/content_server/browse/ Then restart the content server to see the changes. Result should be like…
View browse.css
Add these css rules to the end of /usr/share/calibre/content_server/browse/browse.css
Place them just before the final }}}
#booklist .listnav {
padding-bottom: 1em;
tdack /
Last active Sep 30, 2018
Build the kernel for the Next Thing Co C.H.I.P.
# Desktop build
MAKE="make -j 4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-"
# C.H.I.P. build
tdack /
Last active Sep 2, 2018
Re-usable D3 chart to graph RRD data

Re-usable Chart for RRD data

  • data is fetched from a binary RRD file and converted to JavaScript object
  • charts are generated with re-usable chart object to reduce duplication of code
tdack /
Last active Aug 9, 2016
Create Feral Hosting .ovpn for iOS OpenVPN client
CA=$(< ${KEYSTORE}/ca.crt)
CERT=$(< ${KEYSTORE}/${NAME}.crt)
KEY=$(< ${KEYSTORE}/${NAME}.key)
TLS_AUTH=$(< ${KEYSTORE}/tls-auth.key)