Skip to content

Instantly share code, notes, and snippets.

View tom-henderson's full-sized avatar
🇳🇿

Tom Henderson tom-henderson

🇳🇿
View GitHub Profile
@tom-henderson
tom-henderson / pi-projector.sh
Created February 20, 2013 05:27
Minimal slideshow display for raspberry pi. Install the Arch Linux image to your SD card, boot the Pi with a display attached to the HDMI port, then run this to get set up. To customise: Copy your slides into /root/slides. Edit slide changing schedule by editing the root crontab. Edit /root/startup-slide to set the slide that displays on startup…
#!/bin/bash
# From newly installed arch linux image
# Based on instructions from
# http://www.techrepublic.com/blog/opensource/how-to-create-photo-slideshows-with-as-little-software-as-possible/3716
# update and install requred packages
pacman -Syy
pacman -S fbida ttf-inconsolata
# Set timezone
@tom-henderson
tom-henderson / fcws-browser-check.js
Last active December 27, 2015 17:59
Browser detection script for fcws.
/*
* Test browser support for FirstClass Web Services
* Based on http://www.quirksmode.org/js/detect.html
* Modified to add this.supported
*
* Modern web browsers supported:
* - Internet Explorer 10
* - Safari 6 and above
* - Firefox 16 and above
* - Chrome 22 and above
@tom-henderson
tom-henderson / eventfinda.py
Last active August 29, 2015 14:00
Eventfinda quick start.
import base64
import requests
from pprint import pprint
url = "http://api.eventfinder.co.nz/v2/events.json"
username = "xxxxx"
password = "xxxxx"
auth = base64.encodestring('%s:%s' % (username, password)).replace('\n','')
@tom-henderson
tom-henderson / eztv.py
Last active August 29, 2015 14:00
Get magnet links from an eztv show page
import BeautifulSoup
import requests
import subprocess
url = "http://eztv.it/shows/385/louie/"
html = requests.get(url).text
soup = BeautifulSoup.BeautifulSoup(html)
links = soup.findAll(title="Magnet Link")
@tom-henderson
tom-henderson / backup-exec-sucks.bat
Created July 1, 2014 06:52
Fix issues with backup exec and VSS. In theory.
cd c:\windows\system32
net stop vss
net stop swprv
regsvr32 ole32.dll
regsvr32 vss_ps.dll
Vssvc /Register
regsvr32 /i swprv.dll
regsvr32 /i eventcls.dll
regsvr32 es.dll
regsvr32 stdprov.dll
@tom-henderson
tom-henderson / enable-apache
Last active August 29, 2015 14:05
Enable apache on OS X Mavericks
#!/bin/bash
# Create a user.conf
cat > /etc/apache2/users/$(whoami).conf <<EOF
<Directory "/Users/$(whoami)/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
#!/usr/bin/php
<?php
function asanaRequest($methodPath, $httpMethod = 'GET', $body = null)
{
$apiKey = 'ASANA_API_KEY_HERE'; /// Get it from http://app.asana.com/-/account_api
$url = "https://app.asana.com/api/1.0/$methodPath";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
@tom-henderson
tom-henderson / csv-dicts.py
Created September 14, 2014 11:50
CSV to list of dicts
import csv
# Assumes row 1 of the csv file contains the headers to use as keys
def get_csv_data(path):
data = []
with open(path, 'rb') as f:
reader = csv.reader(f)
headers = reader.next()
@tom-henderson
tom-henderson / nw.py
Created September 15, 2014 21:15
Scrape a list of new world supermarket locations
import requests
from bs4 import BeautifulSoup
from pprint import pprint
url = "http://www.newworld.co.nz/store-map"
html = requests.get(url).text
soup = BeautifulSoup(html)
content = soup.find("div", class_="content")
@tom-henderson
tom-henderson / zomato.py
Created October 16, 2014 22:30
Fetch Zomato Rating
import requests
from bs4 import BeautifulSoup as bs
url = "https://www.zomato.com/auckland/bread-butter-bakery-grey-lynn"
html = requests.get(url).text
soup = bs(html)
rating = float(soup.find("div", class_="rating-div").text.strip())