Skip to content

Instantly share code, notes, and snippets.

@jharlap
jharlap / riak_breaking_upload.coffee
Created May 5, 2011 14:24
riak-js interacting with file upload, causing strange stall
###
This is chopped down from a multi-kloc app, which explains why Connect is involved
and why I would even care to do a riak.get and ignore its result. The issue here is
that if RUN_TEST is 1, doing the riak.get frequently causes the file upload to stall,
while when RUN_TEST is 0 and riak.get is skipped, the file upload works reliably.
###
connect = require 'connect'
fs = require 'fs'
riak = require('riak-js').getClient()
@jharlap
jharlap / PhpSerializedParser.groovy
Created February 3, 2012 17:21
PHP Serialized array/string/integer parser in Groovy
package ch.prodema.misc
class PhpSerializedParser {
private enum ObjectType {
ARRAY('a'), STRING('s'), INTEGER('i')
ObjectType(String typeChar) { this.typeChar = typeChar }
private final String typeChar
private static final Map<String,ObjectType> lookup
static {
@jharlap
jharlap / sqsproducer.go
Created January 21, 2016 18:00
SQS Producer writes each line of a text file as a message to an SQS queue.
package main
import (
"log"
"os"
"fmt"
"bufio"
"flag"
@jharlap
jharlap / Dockerfile
Last active February 11, 2016 14:03
Docker port redirector container
FROM alpine:3.3
RUN apk update && apk upgrade && apk add bash iptables inotify-tools
ADD /start.sh /
CMD ["/start.sh"]
@jharlap
jharlap / README.md
Last active April 27, 2016 04:13
Non-httprouter routers and how to write a response time tracker middleware for them

See the section in each example labelled as MAGIC for how to get the route pattern which matched the url path for each router.

Keybase proof

I hereby claim:

  • I am jharlap on github.
  • I am jharlap (https://keybase.io/jharlap) on keybase.
  • I have a public key ASBAYti-CKqmj4mWc4ZiNhgUSzCv54FX6301Wj_7rC5n3wo

To claim this, I am signing this object: