This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\makeatletter | |
\newwrite\shellout@out | |
\def\shellout@writeout@start#1{% | |
\begingroup | |
\immediate\openout\shellout@out#1% | |
\let\do\@makeother\dospecials% | |
\catcode`\^^M\active% | |
\def\verbatim@processline{% | |
\immediate\write\shellout@out{\the\verbatim@line}}% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
blanking() { | |
local mode="$1"; shift | |
case "$mode" in | |
-|stop) xset -dpms; xset s off ;; | |
+|start) xset +dpms; xset s on ;; | |
sus|suspend) | |
wake-loop & | |
ensure kill $! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Batteries.Printf | |
open Batteries | |
type 't tokstate = Start | Tok of 't | Err of string | Eof | |
type 't state = { | |
mutable index : int ; | |
mutable head : 't tokstate ; | |
mutable behind : 't tokstate list ; | |
mutable ahead : 't tokstate list ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Dynamic = function() { | |
var context = {} | |
var defaults = {} | |
function bind(name, val, fn) { | |
try { | |
var save = context[name]; | |
context[name] = val; | |
var out = fn(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> time node ~/tmp/perf-test.js | |
dynamic | |
real 0m0.697s | |
user 0m0.690s | |
sys 0m0.013s | |
> time node ~/tmp/perf-test.js static | |
static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Monad: | |
@staticmethod | |
def unit(val): | |
raise NotImplemented | |
def bind(self, fn): | |
raise NotImplemented | |
def map(self, map_fn): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// what i assume the callbacks look like | |
abstract class Callback<T> { | |
abstract void run(T data); | |
} | |
// the binding function a -> m b | |
abstract class Step<T, U> { | |
abstract Action<U> into(final T data); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iter [] step out = out | |
iter (x:xs) step out = do | |
val <- x | |
step val (iter xs out) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo == example the first == | |
f1() { | |
local v=1 | |
echo f1: $v | |
f2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
usage() { | |
cat <<EOF | |
Usage: | |
$0 [-r|--recursive] <fname> | |
$0 [-h|-?|--help] |