Skip to content

Instantly share code, notes, and snippets.

tdack /
Created September 12, 2012 12:09
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 / README
Created September 27, 2012 04:39
XML -> HTML using XSL in PHP
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 / date.php
Last active December 27, 2015 15:09
Simple php script to run a shell command on a server when a button is pressed and return the result.
View date.php
$output = array();
$retvar = "";
if ($_GET['run'])
// 2>&1 redirects STDERR to STDOUT
exec("/bin/date 2>&1", $output, $retvar);
tdack /
Last active December 27, 2015 21:39
PHP .htpasswd admin

Quick and dirty .htpasswd admin page for Apache 2.4 or greater.

This uses the newer authentication providers in Apache 2.4 to secure access to the page.

Add the vhost.conf snippet to your directive or server config.

Your .htpasswd file will need write permissions for the group or user that Apache is running as so it can be updated.

There's not many safety checks here, so be careful.

tdack / browse.css
Created November 12, 2013 23:38
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 / Makefile
Last active December 31, 2015 12:09
Commercial detection with silence for UK freeviewHD and Australian Freeview SD/HDSee for detailsRunning:Assuming you use the same locations, your 'Advert-detection command' (mythtv-setup/General/Page 8) should be: /usr/local/bin/ %JOBID% %VERBOSEMODE% --logl…
View Makefile
CC = g++
CFLAGS = -c -Wall -std=c++0x
LIBPATH = -L/usr/lib
TARGETDIR = /usr/local/bin
.PHONY: clean install
all: silence
silence: silence.o
tdack / pw.js
Created January 30, 2014 02:32
View pw.js
var _paq = _paq || [];
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "1"]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
tdack /
Last active August 29, 2015 13:56
DS18B20 1-wire data collection on Raspberry Pi
#!/usr/bin/env python
import os, sys, glob, argparse
import ConfigParser
LOCATIONS = { 'rrd': ''
, 'graphs': ''
, 'sys_base': '/sys/bus/w1/devices/'
, 'config': ''
#!/usr/bin/env python
from commands import getstatusoutput
from platform import node
from socket import socket, AF_INET, SOCK_STREAM
from sys import argv, exit
from time import sleep, time
from daemon import runner
import re
DELAY = 60
tdack / wlan
Created July 3, 2014 00:50
View wlan
echo "$PREREQ"
case $1 in