Skip to content

Instantly share code, notes, and snippets.

View DocSavage's full-sized avatar

Bill Katz DocSavage

View GitHub Profile
ActionController::Routing::Routes.draw do |map|
map.connect ' daily/:year/:month' ,
:controller => ' teetimes' ,
:action => ' index' ,
:month => Time.now.month,
:year => Time.now.year,
:requirements => {
:year => /\d+/,
:month => /\d+/
import com.facebook.thrift.{TBase, TDeserializer}
import java.io.{BufferedInputStream, DataInputStream, File, FileInputStream, InputStream}
import java.util.zip.GZIPInputStream
import net.lag.logging.Logger
import scala.reflect.Manifest
// you'll want to import your generated Thrift package too!
class ThriftFileScanner[T <: TBase](implicit man: Manifest[T]) {
val log = Logger.get
var bufferedIn: BufferedInputStream = null
@DocSavage
DocSavage / hack.sh
Created April 1, 2012 15:26 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@DocSavage
DocSavage / gist:4529160
Last active August 18, 2017 17:16
Nice little DAG walking in Go language from http://golang.org/src/cmd/go/pkg.go
// packageList returns the list of packages in the dag rooted at roots
// as visited in a depth-first post-order traversal.
func packageList(roots []*Package) []*Package {
seen := map[*Package]bool{}
all := []*Package{}
var walk func(*Package)
walk = func(p *Package) {
if seen[p] {
return
@DocSavage
DocSavage / immutable_store.proto
Last active August 29, 2015 14:21
Immutable Ordered Key-Value Store API
// The API can be implemented as HTTP API, gRPC API, and/or Go code level API.
// The specification below uses Google Protobuf 3 IDL and gRPC framework:
// http://www.grpc.io/faq/
// For overview of implementing service with this specification:
// https://github.com/grpc/grpc-common
syntax = "proto3";
package immstore;
@DocSavage
DocSavage / bigtable.go
Last active October 23, 2015 15:53
BigTable GetRange
tbl := client.Open("mytable")
...
unvKeyBeg, _, _ := ctx.UnversionedKey(tkBeg)
unvKeyEnd, _, _ := ctx.UnversionedKey(tkEnd)
rr := bigtable.NewRange(unvKeyBeg, unvKeyEnd)
err := tbl.ReadRows(bt_ctx, rr, func(r Row) bool {
// get all versions from this row and package into "versions" which is []*storage.KeyValue
...
// run it through our DAG to get the proper value given our version context.
// See the code: https://github.com/janelia-flyem/dvid/blob/master/datastore/datainstance.go#L71
@DocSavage
DocSavage / README.txt
Last active April 19, 2020 14:30
VNC NG-precomputed shard file debugging
VNC Pre-computed sharded volume worksheet
Scale 0:
Preshift bits = 9
Minishard bits = 6 2^15 chunks if no collisions = 32 KiChunks @ 64^3 chunks (262 KiVoxels) = 8.46 GiVoxels
Shard bits = 16
Block (335, 438, 1024) -> corresponds to 64^3 with first voxel at (21440, 28032, 66536)
X block 335 = 14F
Y block 438 = 1B6