Skip to content

Instantly share code, notes, and snippets.

View 0xYUANTI's full-sized avatar

JJS 0xYUANTI

View GitHub Profile
@0xYUANTI
0xYUANTI / gist:4176431
Created November 30, 2012 15:29
The reftrick: shell dump
Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.9.2 (abort with ^G)
1> c(reftrick).
{ok,reftrick}
2> spawn(fun() -> reftrick:plain() end).
<0.38.0>
time(reftrick): 3.410ms recv1
time(reftrick): 704.826ms recv2
3> spawn(fun() -> reftrick:plain() end).
@0xYUANTI
0xYUANTI / gist:4176424
Created November 30, 2012 15:28
The reftrick: code
-module(reftrick).
-compile(export_all).
%% Luke Gorrie's favourite profiling macro.
-define(TIME(Tag, Expr),
(fun() ->
%% NOTE: timer:tc/4 does an annoying 'catch' so we
%% need to wrap the result in 'ok' to be able to
%% detect an unhandled exception.
{__TIME, __RESULT} =
@0xYUANTI
0xYUANTI / cut.clj
Created December 25, 2011 11:28
My first Clojure program
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Clojure port of Scheme's SRFI-26 ``Curry Upon This'' macro package
;;; (strictly inferior to Clojure's built-in lambda-syntax).
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;_* Declarations =====================================================
(ns cut
(:use clojure.test))
(declare gen slot? rest-slot? eval?)
#!/usr/bin/mawk -f
# long lines
length() > 79
# trailing whitespace
/[ ]+$/
# tabs
/[\t]/
@0xYUANTI
0xYUANTI / bench.erl
Created February 16, 2011 12:41
disk_log vs file
-module(bench).
-compile(export_all).
%% Luke Gorrie's favourite profiling macro.
-define(TIME(Tag, Expr),
(fun() ->
%% NOTE: timer:tc/4 does an annoying 'catch' so we
%% need to wrap the result in 'ok' to be able to
%% detect an unhandled exception.
{__TIME, __RESULT} =