Skip to content

Instantly share code, notes, and snippets.

View kortschak's full-sized avatar

Dan Kortschak kortschak

View GitHub Profile
@kortschak
kortschak / blackswan.go
Created August 29, 2012 00:19
failing case for GoLLRB deletion on non-uniquely inserted tree
package main
import (
"fmt"
"github.com/petar/GoLLRB/llrb"
)
func isBalanced(t *llrb.Tree) bool {
if t == nil {
return true
@kortschak
kortschak / fetch.c
Created June 19, 2012 01:31
bam_fetch example
#include <stdio.h>
#include "sam.h"
// callback for bam_fetch()
static int fetch_func(const bam1_t *b, void *data)
{
printf("%s %d %d %d\n", b->data, b->core.tid, b->core.pos, b->core.l_qseq);
return 0;
}
@kortschak
kortschak / feature.go
Created June 12, 2012 01:50
new feature package start
// Copyright ©2012 Dan Kortschak <dan.kortschak@adelaide.edu.au>
package feat
type Conformationer interface {
Conformation() Conformation
}
type Conformation int8
@kortschak
kortschak / boom.go
Created June 4, 2012 04:31
start of bam wrapper
// Copyright ©2012 Dan Kortschak <dan.kortschak@adelaide.edu.au>
package boom
// http://samtools.sourceforge.net/samtools/sam/index.html
/*
#cgo LDFLAGS: -L/usr/local/src/samtools_latest -lbam -lz
#include "sam.h"
static int fileType(samfile_t *fp) { return fp->type; }
@kortschak
kortschak / pprof.svg
Created April 30, 2012 09:53
dlog profile svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kortschak
kortschak / collide.go
Created April 12, 2012 21:48
hash collision
package main
import (
"crypto/sha256"
"fmt"
"math/rand"
"os"
"time"
)
@kortschak
kortschak / offset.go
Created March 14, 2012 02:16
Offset slice benchmark
package main
import (
"fmt"
"testing"
)
// An offset slice seems to be the only way to implement the C idiom to
// an offset (by o) a view (v) on an array (a):
// int *v, o;
//Use morass when you don't want your data to be a quagmire.
//
//Sort data larger than can fit in memory.
//
// morass məˈras/
// 1. An area of muddy or boggy ground.
// 2. A complicated or confused situation.
package morass
// Copyright ©2011 Dan Kortschak <dan.kortschak@adelaide.edu.au>
@kortschak
kortschak / peers.go
Created February 20, 2012 00:45
Example PeerCertificates empty
package main
import (
"bufio"
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
@kortschak
kortschak / dirmod.go
Created February 5, 2012 20:54
attempt at unsafe manipulation of chan dir
package main
import (
"fmt"
"reflect"
"runtime"
"unsafe"
)
type commonType struct {