Skip to content

Instantly share code, notes, and snippets.

View tomnomnom's full-sized avatar
☺️
Taking it easy

TomNomNom tomnomnom

☺️
Taking it easy
View GitHub Profile
@tomnomnom
tomnomnom / robot.py
Last active August 27, 2015 15:58
Playing with OpenCV; making myself into a robot
import cv2
# See https://www.youtube.com/watch?v=FH5oDFgLSs4 for example output
cap = cv2.VideoCapture(0)
face_cascade = cv2.CascadeClassifier("/usr/share/opencv/haarcascades/haarcascade_frontalface_default.xml")
eye_cascade = cv2.CascadeClassifier("/usr/share/opencv/haarcascades/haarcascade_eye.xml")
fourcc = cv2.cv.CV_FOURCC(*'XVID')
out = cv2.VideoWriter('output.avi',fourcc, 15, (640,480))
@tomnomnom
tomnomnom / lolstore.go
Created January 21, 2015 14:20
lolstore
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)
@tomnomnom
tomnomnom / simple-json-api.go
Created December 20, 2014 16:34
Simple JSON API Server in Go
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
)
// The `json:"whatever"` bit is a way to tell the JSON
@tomnomnom
tomnomnom / simple-vm.go
Created October 29, 2014 11:10
Simple VM in Go
package main
import (
"fmt"
"log"
"strings"
)
// Ops
const (

Keybase proof

I hereby claim:

  • I am TomNomNom on github.
  • I am tomnomnom (https://keybase.io/tomnomnom) on keybase.
  • I have a public key whose fingerprint is 52D9 4FE1 8D6A A5EF 0FE3 3ECE CE03 0B9A DABB DC9E

To claim this, I am signing this object:

alert(1);
@tomnomnom
tomnomnom / node-hello.js
Created March 5, 2014 09:06
Node.js Hello World Server
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '0.0.0.0');
console.log('Server running at http://0.0.0.0:1337/');
@tomnomnom
tomnomnom / rsync-link-dest.sh
Last active August 29, 2015 13:56
Rsync with --link-dest wrapper
@tomnomnom
tomnomnom / extract.php
Created February 5, 2014 13:35
PHP Extract Function
<?php
function array_extract(array $input, array $keys){
$output = [];
foreach ($keys as $key){
if (!array_key_exists($key, $input)) continue;
$output[$key] = $input[$key];
}
return $output;
}
@tomnomnom
tomnomnom / find-bt-address-id.php
Created December 9, 2013 17:03
Hacky script for finding BT Address IDs
<?php
const HOUSE_NUMBER = 2;
const POSTCODE = 'LS1 4AP';
const SERVICE_URL = 'http://www.productsandservices.bt.com/consumerProducts/v1/addressSearch.do';
$query = http_build_query(array(
'postcode' => POSTCODE,