Skip to content

Instantly share code, notes, and snippets.

@tdack
tdack / overviewer_config.py
Created September 12, 2012 12:09
Minecraft Overviewer dynamic config file
# Minecraft Overviewer dynamic config file for multiple Minecraft worlds
# managed by MSM (https://github.com/marcuswhybrow/minecraft-server-manager)
import os
# Define where to put the output here.
outputdir = "/storage/www/vhosts/minecraft.example.com"
# Add Javascript to map when rendering
from observer import JSObserver
@tdack
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
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.
<?php
$output = array();
$retvar = "";
if ($_GET['run'])
{
// 2>&1 redirects STDERR to STDOUT
exec("/bin/date 2>&1", $output, $retvar);
}
?>
<html>
@tdack
tdack / README.md
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
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 https://plus.google.com/u/0/photos/+TroyDack/albums/5763024133998901281/5945519253353…
/*
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
tdack / Makefile
Last active December 31, 2015 12:09
Commercial detection with silence for UK freeviewHD and Australian Freeview SD/HDSee http://www.mythtv.org/wiki/Commercial_detection_with_silence_for_UK_freeviewHD for detailsRunning:Assuming you use the same locations, your 'Advert-detection command' (mythtv-setup/General/Page 8) should be: /usr/local/bin/silence.py %JOBID% %VERBOSEMODE% --logl…
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
tdack / pw.js
Created January 30, 2014 02:32
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://piwik.dack.com.au/";
_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
tdack / create_config.py
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
tdack / wlan
Created July 3, 2014 00:50
/etc/initramfs-tools/hooks/wlan
#!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in