Skip to content

Instantly share code, notes, and snippets.

Avatar
🤙
!

Sean Robertson spro

🤙
!
View GitHub Profile
@spro
spro / cropper.coffee
Last active Aug 29, 2015
Image cropping service in CoffeeScript
View cropper.coffee
http = require 'http'
url = require 'url'
sharp = require 'sharp'
request = require('request').defaults({ encoding: null })
config =
PORT: 2455
server = http.createServer (req, res) ->
@spro
spro / gist:8851965
Created Feb 6, 2014
valgrind --leak-check=yes node cropper.js
View gist:8851965
-- 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)
View keybase.md

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:

View rainforest.coffee
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')
View gist:84f62bcd66207aa1e136
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 Sep 23, 2014
React.js test with flux-ish data/action layer and undoable states
View counters.coffee
D = React.DOM
Button = ({text, action}) ->
D.button(onClick: action, text)
# Views
# ------------------------------------------------------------------------------
# <App>
# - <Counter Collection>
@spro
spro / bookshelf-basic.coffee
Last active Aug 29, 2015
Bookshelf.js Examples
View bookshelf-basic.coffee
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 Aug 29, 2015
hipache reimplimented in lua in nginx
View hipache.nginx.conf
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'])
View gist:aa3693b8e9b8a96a5240
Verifying that +spro is my openname (Bitcoin username). https://onename.com/spro
@spro
spro / gist:7c929c5213253e054a04
Created Jun 17, 2015
Overly simple REST API with Bottle.py
View gist:7c929c5213253e054a04
import bottle
import json
all_people = [
{'name': 'Fred Wilson'},
{'name': 'Fred Durst'},
{'name': 'Fred Astaire'},
]
@bottle.get('/people.json')