Skip to content

Instantly share code, notes, and snippets.

View dvliman's full-sized avatar

David Liman dvliman

View GitHub Profile
@dvliman
dvliman / gist:6105199
Created July 29, 2013 15:33
problem installing log.io on ubuntu 13.04
npm ERR! error rolling back [email protected] Error: ENOTEMPTY, rmdir '/usr/local/lib/node_modules/log.io/node_modules/jquery/node_modules/jsdom'
npm ERR! error installing [email protected]
npm http 304 https://registry.npmjs.org/tinycolor
npm ERR! Error: ENOENT, open '/usr/local/lib/node_modules/log.io/node_modules/jquery/node_modules/jsdom/node_modules/___cssom.npm/package/lib/CSSKeyframesRule.js'
npm ERR! You may report this log at:
npm ERR! <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR! reportbug --attach /usr/local/lib/npm-debug.log npm
npm ERR!
package main
import (
"crypto/tls"
"net"
"net/http"
"time"
"fmt"
"errors"
)
@dvliman
dvliman / linear partition
Created August 12, 2013 13:43
linear partition
# Linear partition
# Partitions a sequence of non-negative integers into k ranges
# Based on Óscar López implementation in Python (http://stackoverflow.com/a/7942946)
# Also see http://www8.cs.umu.se/kurser/TDBAfl/VT06/algorithms/BOOK/BOOK2/NODE45.HTM
# Dependencies: UnderscoreJS (http://www.underscorejs.org)
# Example: linear_partition([9,2,6,3,8,5,8,1,7,3,4], 3) => [[9,2,6,3],[8,5,8],[1,7,3,4]]
linear_partition = (seq, k) =>
n = seq.length
(function () {
var n = this,
t = n._,
r = {}, e = Array.prototype,
u = Object.prototype,
i = Function.prototype,
a = e.push,
o = e.slice,
c = e.concat,
l = u.toString,
def to_route(url)
#strip out the /v4/
url = url[4..-1]
dot = url.index('.')
#strip out the extension
url = url[0...dot] unless dot.nil?
parts = url.split('/')
if parts.length == 1
"list #{parts[0]}"
/**
* Serialgraphy
* https://www.facebook.com/serialgraphy
*
* Released Under MIT License
* http://opensource.org/licenses/MIT
*/
/**
* Global Helpers
/* Tiny web server in Golang for sharing a folder
Copyright (c) 2010 Alexis ROBERT <[email protected]>
Contains some code from Golang's http.ServeFile method, and
uses lighttpd's directory listing HTML template. */
package main
import "http"
import "io"
bam: bam.c
gcc -g3 -I/usr/local/include -L/usr/local/lib -lcmph -lmicrohttpd bam.c -o bam
urls.txt: test.tsv
cut -f1 $^ | perl -nle 'print "http://localhost:8080/$$_"' > $@
clean:
rm -rf bam bam.dSYM
@dvliman
dvliman / gist:6419102
Created September 3, 2013 02:30
ruby lib load path
$:.unshift(File.dirname(__FILE__))
lib/
app.rb
app/