Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am wadey on github.
  • I am wadey (https://keybase.io/wadey) on keybase.
  • I have a public key whose fingerprint is 6B06 FA83 D482 D52A E59E C5F8 0B42 F7A3 E3D9 D6D7

To claim this, I am signing this object:

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
@wadey
wadey / betagoal.py
Last active August 29, 2015 14:02
World Cup Slack Bot (with delay for no spoilers)
import time
import json
from twitter import TwitterStream, OAuth
import requests
import settings
twitter_stream = TwitterStream(
auth=OAuth(
@wadey
wadey / godeps.zsh
Created August 25, 2015 18:15
godeps
#!/bin/zsh
typeset -A DONE
_dep() {
go list -f "{{if not .Standard}}{{printf \"\t%q -> %q;\n\" \"$1\" .ImportPath}}{{end}}" "$2"
}
_graph() {
if [ -z ${DONE[$1]} ]
@wadey
wadey / index.html
Created December 3, 2010 22:06
SimpleGeo Advanced getLocation Example
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script src="http://cdn.simplegeo.com/js/1.2/simplegeo.context.jq.min.js"></script>
<script type="text/javascript" src="http://github.com/simplegeo/polymaps/raw/v2.4.0/polymaps.js"></script>
</head>
<body>
<script type="text/javascript">
@wadey
wadey / get_location_1.js
Created December 21, 2010 22:27
SimpleGeo JavaScript getLocation examples
client.getLocation({enableHighAccuracy: true}, function(err, position) {
if (err) {
// Could not retrieve location information. Check err for more information
} else {
// Latitude and longitude available in position.coords
}
});
@wadey
wadey / example-server.js
Created December 31, 2010 20:16
Example node-thrift server
var thrift = require('thrift');
var JobExchange = require('./gen-nodejs/JobExchange'),
ttypes = require('./gen-nodejs/scheduler_types');
var server = thrift.createServer(JobExchange, {
insert_job: function(job, callback) {
// job is an instance of ttypes.Job
process.nextTick(function() {
callback(1);
// This example attempts to time out before the connection is established
var net = require('net');
var start = Date.now();
var stream = net.createConnection(9999, 'google.com');
stream.setTimeout(1000);
var thrift = require('thrift');
var sys = require('sys');
var scheduler_thrift = require('./gen-nodejs/JobExchange.js'),
scheduler_ttypes = require('./gen-nodejs/scheduler_types.js');
var conn = thrift.createConnection('localhost', 8081),
client = thrift.createClient(scheduler_thrift, conn);
conn.on('error', function(err) {
@wadey
wadey / index.html
Created January 13, 2011 18:35 — forked from mager/index.html
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
@import url("http://github.com/simplegeo/polymaps/raw/v2.4.0/examples/example.css");
html, body {height: 100%;}
svg {display: block;}
.layer circle {fill: #f00;stroke: #000;stroke-width: 2px;}
</style>