Skip to content

Instantly share code, notes, and snippets.

View carlosmn's full-sized avatar
💭
Buried under a heap of yaks under a stack of todos

Carlos Martín Nieto carlosmn

💭
Buried under a heap of yaks under a stack of todos
View GitHub Profile
@carlosmn
carlosmn / main.c
Created October 25, 2012 13:44
Fußgängerampel-Simulation
#define SLEEP_QUANTUM 10000
#define SLEEP(n) do { \
long time = n * 100000; /* wait() sleeps 10*n microseconds */ \
while(time > SLEEP_QUANTUM) { \
wait(SLEEP_QUANTUM); \
time -= SLEEP_QUANTUM; \
} \
wait(time); \
} while(0)
@carlosmn
carlosmn / web.go
Created October 17, 2012 18:57
A mock git-http-backend to test pushing
package main
import (
"io"
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, req *http.Request) {
req.ParseForm()
@carlosmn
carlosmn / newly-unreachable.rb
Created February 6, 2012 23:47
A libgit2 implementation of git fsck --unreachable
#!/usr/bin/env ruby
require 'rubygems'
require 'rugged'
require 'set'
def objects_in_tree(repo, tree, objs)
tree.each do |e|
objs << e[:oid]
if e[:type] == :tree then
@carlosmn
carlosmn / Makefile
Created January 31, 2012 00:37
Small benchmark
CFLAGS=-I/home/carlos/staging/libgit2/include -ggdb
all: checkout lowlevel
checkout: checkout.o
gcc -ggdb -o checkout checkout.o
lowlevel: lowlevel.o
gcc -ggdb -o lowlevel lowlevel.o -I/home/carlos/staging/libgit2/include -L/home/carlos/staging/libgit2/lib -lgit2