Skip to content

Instantly share code, notes, and snippets.

View wpf500's full-sized avatar

Will Franklin wpf500

View GitHub Profile

Keybase proof

I hereby claim:

  • I am wpf500 on github.
  • I am wpf500 (https://keybase.io/wpf500) on keybase.
  • I have a public key ASCeKUy8yAb1LtmurkH3jov8Tm4FiCRoWFF3z5kIq1H4bQo

To claim this, I am signing this object:

@wpf500
wpf500 / project.js
Created July 31, 2015 13:01
Pre-projection for Leaflet
// Based on Leaflet's projection/transformation functions
var project = (function () {
var R = 6378137, d = Math.PI / 180, max = 1 - 1E-15;
var a = 0.5 / (Math.PI * R);
function _project(lat, lng) {
var sin = Math.max(Math.min(Math.sin(lat * d), max), -max);
return [R * lng * d, R * Math.log((1 + sin) / (1 - sin)) / 2];
}
@wpf500
wpf500 / log-search.py
Created January 9, 2015 17:29
For AWS CloudWatch Logs. Finds the log streams with in a log group that contain log events for a given time and display the relevant logs
#!/usr/bin/python
import sys, boto.logs, time
from datetime import datetime
log_group = 'LOG GROUP NAME'
timestamp = int(datetime.strptime(sys.argv[1], '%Y-%m-%dT%H:%M:%S').strftime('%s')) * 1000
logs = boto.logs.connect_to_region('eu-west-1')
if len(sys.argv) > 2:
@wpf500
wpf500 / gist:ac3b161269107d8e5f60
Created August 15, 2014 16:04
Conditional CSRFFilter
class CSRFFilterWithExemptions extends EssentialFilter {
val csrfFilter = CSRFFilter()
def apply(next: EssentialAction): EssentialAction = new EssentialAction {
def apply(rh: RequestHeader): Iteratee[Array[Byte], Result] = {
if (/* some test here */) {
csrfFilter(next)(rh)
} else {
next(rh)
}
common stuff
enum cargo type
BREAD
TVS
etc.
position
tuple<longitude,latitude>
class cargo