Skip to content

Instantly share code, notes, and snippets.

@csabahenk
csabahenk / README.md
Created July 21, 2011 00:44
Rsync rolling sum calculation in various languages

Rsync rolling sum calculation in various languages

The programs below calculate the rsync weak sum (of block size 4096) of the last block of the data available on stdin.

The data is assumed to be at least block size big; the weak sum is calculated in a direct manner for the first block, and from that on, the sum is adjusted on each incoming byte using the "rollability" of this kind of checksum.

The primary goal was to see the performance of naive implementations; so my metrics was both performance and "how close is the code to

@csabahenk
csabahenk / Makefile
Created January 17, 2011 02:04
the buggy example of http://golang.org/pkg/rpc/ with two fixes
include $(GOROOT)/src/Make.inc
TARG=aserver\
aclient
SHARED=arith
all: $(SHARED:%=%.$O) $(TARG)
$(TARG): %: %.$O
@csabahenk
csabahenk / strafi.rb
Created January 8, 2011 04:53
ruby script to inspect / filter processes in a strace log on Linux
#!/usr/bin/env ruby
if RUBY_VERSION < "1.9"
class Symbol
def to_proc
proc { |obj, *args| obj.send self, *args }
end
end
end