Skip to content

Instantly share code, notes, and snippets.

View spro's full-sized avatar
🤙
!

Sean Robertson spro

🤙
!
View GitHub Profile
@spro
spro / gist:8851965
Created February 6, 2014 20:33
valgrind --leak-check=yes node cropper.js
-- these occur frequently:
==20106== Conditional jump or move depends on uninitialised value(s)
==20106== at 0x810B6B6: ??? (in /usr/lib/libjpeg.so.8.0.2)
==20106== by 0x8107CA3: ??? (in /usr/lib/libjpeg.so.8.0.2)
==20106== by 0x810C682: ??? (in /usr/lib/libjpeg.so.8.0.2)
==20106== by 0x8106DC9: jpeg_read_scanlines (in /usr/lib/libjpeg.so.8.0
==20106== by 0x77CB53F: read_jpeg_generate (jpeg2vips.c:932)
==20106== by 0x77F3A38: vips_region_generate (region.c:1074)
==20106== by 0x77F4B0F: vips_region_prepare_to_generate (region.c:1196)
@spro
spro / cropper.coffee
Last active August 29, 2015 13:56
Image cropping service in CoffeeScript
http = require 'http'
url = require 'url'
sharp = require 'sharp'
request = require('request').defaults({ encoding: null })
config =
PORT: 2455
server = http.createServer (req, res) ->

Keybase proof

I hereby claim:

  • I am spro on github.
  • I am spro (https://keybase.io/spro) on keybase.
  • I have a public key whose fingerprint is C66D 0B30 C6AD 364F 48D5 F21F 087C 2F86 D07C 4554

To claim this, I am signing this object:

fs = require 'fs'
util = require 'util'
exec = require('child_process').exec
jsdom = require 'jsdom'
jquery = require 'jquery'
_ = require 'underscore'
# Github APIs require a user agent to be set, so set one by default
request = require('request')
@spro
spro / gist:84f62bcd66207aa1e136
Last active August 29, 2015 14:05
Consul panic
2014/08/21 08:52:13 [INFO] consul.fsm: snapshot created in 23.435us
2014/08/21 08:52:13 [INFO] raft: Starting snapshot up to 8232
2014/08/21 08:52:13 [INFO] snapshot: Creating new snapshot at /tmp/consul/raft/snapshots/2-8232-2014-08-21T08:52:13.72566997-07:00.tmp
2014/08/21 08:52:13 [INFO] raft: Compacting logs from 1 to 8232
panic: runtime error: index out of range
goroutine 30 [running]:
runtime.panic(0x9bdc40, 0xf763fc)
/opt/go/src/pkg/runtime/panic.c:279 +0xf5
encoding/binary.bigEndian.Uint64(0xf8f230, 0x0, 0x0, 0xc208201300)
@spro
spro / counters.coffee
Created September 23, 2014 00:16
React.js test with flux-ish data/action layer and undoable states
D = React.DOM
Button = ({text, action}) ->
D.button(onClick: action, text)
# Views
# ------------------------------------------------------------------------------
# <App>
# - <Counter Collection>
@spro
spro / bookshelf-basic.coffee
Last active August 29, 2015 14:12
Bookshelf.js Examples
knex = require('knex')(client: 'pg', connection: 'postgres:///test1')
bookshelf = require('bookshelf')(knex)
util = require 'util'
inspect = (o) -> console.log util.inspect o.toJSON(), colors: true
# Schema
# ------
User = bookshelf.Model.extend
@spro
spro / hipache.nginx.conf
Last active August 29, 2015 14:13
hipache reimplimented in lua in nginx
location / {
set $proxy_to "";
access_by_lua "
local redis = require 'redis'
local red = redis:new()
red:connect('127.0.0.1', 6379)
local headers = ngx.req.get_headers()
local hosts = red:smembers('frontend:' .. headers['host'])
Verifying that +spro is my openname (Bitcoin username). https://onename.com/spro
@spro
spro / gist:7c929c5213253e054a04
Created June 17, 2015 07:39
Overly simple REST API with Bottle.py
import bottle
import json
all_people = [
{'name': 'Fred Wilson'},
{'name': 'Fred Durst'},
{'name': 'Fred Astaire'},
]
@bottle.get('/people.json')