Skip to content

Instantly share code, notes, and snippets.

@tdack
tdack / create-ovpn.sh
Last active August 9, 2016 13:28
Create Feral Hosting .ovpn for iOS OpenVPN client
#!/bin/bash
NAME=$1
FERAL_SERVER=$2
KEYSTORE=./keys
CA=$(< ${KEYSTORE}/ca.crt)
CERT=$(< ${KEYSTORE}/${NAME}.crt)
KEY=$(< ${KEYSTORE}/${NAME}.key)
TLS_AUTH=$(< ${KEYSTORE}/tls-auth.key)
OUTPUT=./${NAME}.ovpn
@tdack
tdack / readme.txt
Created May 8, 2016 22:51
Buildroot config for OrangePi Plus
# board/orangepi/orangepi_plus/readme.txt
OrangePi Plus
Intro
=====
This default configuration will allow you to start experimenting with the
buildroot environment for the OrangePi PC. With the current configuration
it will bring-up the board, and allow access through the serial console.
@tdack
tdack / console.log
Last active January 10, 2016 06:18
Kivy Raspberry Pi installation
pi@raspberrypi ~ $ sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \
pkg-config libgl1-mesa-dev libgles2-mesa-dev \
python-setuptools libgstreamer1.0-dev git-core \
gstreamer1.0-plugins-{bad,base,good,ugly} \
gstreamer1.0-{omx,alsa} python-dev cython
pi@raspberrypi ~ $ sudo pip install git+https://github.com/kivy/kivy.git@master
pi@raspberrypi ~ $ sudo apt-get install python-{pygments,docutils}
@tdack
tdack / upgrade_ghost.sh
Last active January 6, 2016 23:45 — forked from anonymous/upgrade_ghost.sh
Bash script to upgrade your Ghost blog installation to the latest version
#!/bin/bash
# Make sure only root can run our script
if [[ ${EUID} -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
if [[ $# -eq 0 ]]; then
echo "Usage:"
echo " $0 <systemd|sysv>"
@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 / 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 / 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
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 / pendulum.cpp
Created August 16, 2015 13:19
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.md
Last active August 29, 2015 14:18
Grab Bigpond usage using Python

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