Skip to content

Instantly share code, notes, and snippets.

View spro's full-sized avatar
🤙
!

Sean Robertson spro

🤙
!
View GitHub Profile
@spro
spro / why_spool.sh
Created April 18, 2013 21:44
Follow _why's SPOOL in real time.
#!/bin/sh
# Read _why's SPOOL in real time.
# Requires `lp` and a printer.
BASEURL=http://whytheluckystiff.net
if [ ! -d SPOOL ]; then
mkdir SPOOL
fi
events {
worker_connections 1024;
}
http {
include mime.types;
server {
listen 8080;
server_name localhost;
@spro
spro / nginx_lua.conf
Created September 9, 2013 21:53
Example nginx configuration with a simple Lua script acting at /hello
events {
worker_connections 1024;
}
http {
include mime.types;
server {
listen 8080;
server_name localhost;
http = require 'http'
fs = require 'fs'
util = require 'util'
qs = require 'querystring'
get_score_data = ->
http.get 'http://sports.espn.go.com/nfl/bottomline/scores', (res) ->
data = ''
res.on 'data', (chunk) ->
data += chunk
insert_comment = ($comments, comment_data) ->
# add this comment into the given $comments div somehow
$ ->
# create $comments
$comments = $('<div id="comments">')
$.get '/posts/123/comments.json', (comments_data) ->
for comment_data in comments_data
insert_comment $comments, comment_data
@spro
spro / gist:8839678
Last active April 7, 2016 07:45
Error in `node': corrupted double-linked list
*** Error in `node': corrupted double-linked list: 0x000000000a61c4b0 ***
======= Backtrace: =========
/usr/lib/libc.so.6(+0x72d7f)[0x7fb7d3285d7f]
/usr/lib/libc.so.6(+0x7854e)[0x7fb7d328b54e]
/usr/lib/libc.so.6(+0x795c9)[0x7fb7d328c5c9]
/usr/lib/libjpeg.so.8(+0x2ce1d)[0x7fb7d218fe1d]
/usr/lib/libjpeg.so.8(jpeg_abort+0x15)[0x7fb7d2175bf5]
/usr/lib/libjpeg.so.8(jpeg_finish_decompress+0x54)[0x7fb7d2179ad4]
/usr/lib/libvips.so.37(+0x11b318)[0x7fb7d297c318]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x138)[0x7fb7d19b66a8]
@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')