Skip to content

Instantly share code, notes, and snippets.

@barrbrain
barrbrain / packsize.sh
Created March 13, 2012 00:24
A script to calculate a push strategy for a ref, given a pack size limit.
#!/bin/bash
LIMIT=$1
TIP=$2
BS=$(( 64 * 1024 ))
COUNT=$(( ( $LIMIT ) / $BS ))
packsize() {
COMMITS=$1
ENDPOINT=$TOP
@barrbrain
barrbrain / mergesort.hs
Created March 18, 2011 12:49
An attempt at an bottom-up functional representation of mergesort
import Control.Arrow
import Data.List
import Data.Function
main = interact (show.(mergeSort (<=)).head.lines)
merge :: (a -> a -> Bool) -> [a] -> [a] -> [a]
merge _ xs [] = xs
merge _ [] ys = ys
merge p (x:xs) (y:ys) =
@barrbrain
barrbrain / header.bin
Created March 15, 2011 13:46
Simple XML record stream processor. Uses node-binary, node-postgres and xml2js-expat.