Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am bitbckt on github.
  • I am bitbckt (https://keybase.io/bitbckt) on keybase.
  • I have a public key whose fingerprint is DD22 A16E 3311 F49A EA36 FF04 2073 DF75 F0BF BFDA

To claim this, I am signing this object:

[alias]
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
fuckit = reset --hard HEAD
[push]
default = simple
@bitbckt
bitbckt / hprof.c
Last active December 16, 2015 00:29
An example hprof reader.
#include <arpa/inet.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#define HPROF_OK 0
#define HPROF_ERR -1
/* Shamelessly copied from src/share/vm/services/heapDumper.cpp */
@bitbckt
bitbckt / main.c
Created April 4, 2013 23:54
Teensy 3.0, Easy Driver and Small Stepper from SparkFun
#include "WProgram.h"
/* EasyDriver direction and step trigger pins */
#define DIR_PIN 22
#define STEP_PIN 23
/* SparkFun's "Small stepper motor" - stride angle = 7.5 deg.*/
#define STEPS_PER_REVOLUTION 48.0
#define USTEPS_PER_STEP 8.0
@bitbckt
bitbckt / sonar.cpp
Created April 3, 2013 18:45
Sampling an XL-MaxSonar-EZ from Teensy 3.0.
#include "WProgram.h"
#define PIN 3
#define SAMPLE_RATE 10 /* Hz */
#define SAMPLE_SIZE 9
/* uS / cm - see XL-MaxSonar-EZ Series data sheet for MB1200 scaling factor */
#define SCALE 58
#define SWAP(a,b) do { \
I: Running command '/usr/local/bin/ocamlbuild src/odn.cma src/odn.cmxa src/odn.a src/pa_noodn.cma tests/test.byte -tag debug'
I: No need to copy file '_build/tests/test.byte' to '_build/tests/test', same content
I: Running command '/usr/local/bin/ocamlbuild src/pa_odn.cma -tag debug'
ocamlfind ocamlc -c -g -package type-conv -package camlp4.quotations.o -package camlp4.lib -syntax camlp4o -I src -o src/pa_odn.cmo src/pa_odn.ml
+ ocamlfind ocamlc -c -g -package type-conv -package camlp4.quotations.o -package camlp4.lib -syntax camlp4o -I src -o src/pa_odn.cmo src/pa_odn.ml
File "src/pa_odn.ml", line 203, characters 21-33:
Error: This expression has type
Camlp4.PreCast.Ast.Loc.t ->
Camlp4.PreCast.Ast.ctyp -> Camlp4.PreCast.Ast.expr
but an expression was expected of type
==============================================================
BYTE UNIX Benchmarks (Version 4.1.0)
System -- bitbckt.twitter.corp
Start Benchmark Run: Thu Apr 21 11:43:43 PDT 2011
1 interactive users.
11:43AM up 18:08, 1 user, load averages: 0.00, 0.00, 0.00
-r-xr-xr-x 1 root wheel 136696 Feb 16 18:18 /bin/sh
/bin/sh: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked (uses shared libs), for FreeBSD 8.2, stripped
/dev/ad4s1f 456794400 2723686 417527162 1% /usr
Failing RubySpec:
/Users/brandon/Projects/rubyspec/language/versions/next_1.8.rb:3: [BUG] rb_gc_mark(): unknown data type 0x30(0x7fff5fbf1be0) non object
(gdb) bt 10
#0 0x00007fff85437616 in __kill ()
#1 0x00007fff854d7cca in abort ()
#2 0x000000010001899d in rb_bug (fmt=Could not find the frame base for "rb_bug".
) at error.c:213
#3 0x00000001000451b2 in gc_mark_children (ptr=140734799748064) at gc.c:2113
#4 0x000000010004491d in rb_gc_mark (ptr=140734799748064) at gc.c:1853
module LazyMonad =
struct
type 'a t = 'a lazy_t
let return x = lazy x
let bind m f = lazy (Lazy.force f (Lazy.force m))
end;;
@bitbckt
bitbckt / *scratch*
Created April 13, 2010 19:32
Parallel invoke HOF in OCaml
let invoke (f : 'a -> 'b) x : unit -> 'b =
let input, output = Unix.pipe() in
match Unix.fork() with
| -1 -> (let v = f x in fun () -> v)
| 0 -> Unix.close input;