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
wc -l data/* | awk '{if ($1 > 3000) print $1, $2}' |
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
(define (js-format l) | |
(cond | |
((null? l) "") | |
((not (list? (car l))) (string-append (format #f "'~a'" (car l)) | |
(if (not (null? (cdr l))) | |
(string-append "," (js-format (cdr l))) | |
""))) | |
(else (string-append "\n[" (js-format (car l)) | |
(if (not (null? (cdr l))) | |
(string-append "]," (js-format (cdr l))) |
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 variablep = function(x) { | |
// String is a primitive, so x instanceof String does not do what you think | |
return (typeof x === "string") && (x[0] == "?"); | |
} | |
var equal = function(x,y) { | |
if (x === y) return true; | |
if (x == y) return true; | |
if (typeof x === 'string' && typeof y === 'string' | |
&& x.toLowerCase() == y.toLowerCase()) return true; | |
if (typeof x === 'array' && typeof y === 'array' && x.length == y.length) { |
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
CREATE TABLE accounts( | |
id serial PRIMARY KEY, | |
name VARCHAR(256) NOT NULL | |
); | |
CREATE TABLE entries( | |
id serial PRIMARY KEY, | |
description VARCHAR(1024) NOT NULL, | |
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0), | |
-- Every entry is a credit to one account... |
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
; Scheme based Domain Specific Language for computing Basal Metabolic Rate | |
; using the Harris-Benedict formula. | |
; https://en.wikipedia.org/wiki/Harris–Benedict_equation | |
"Goal: implement syntax transformers for a program like the following:" | |
'(basal-metabolic-rate | |
(metric | |
(male | |
(weight 90 kg) | |
(height 190 cm) |
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
function convert_time(t) { | |
split(t,a,"/"); | |
if (a[3] > 50) { | |
a[3] = sprintf("19%02d", a[3]); | |
} else { | |
a[3] = sprintf("20%02d", a[3]); | |
} | |
month = a[1]; | |
day = a[2]; | |
year = a[3]; |
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
(define (product . args) | |
(if (null? args) | |
(list '()) | |
(apply append | |
(map (lambda (rest) | |
(map (lambda (first) | |
(cons first rest)) | |
(car args))) | |
(apply product (cdr args)))))) |
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
(define (shuffle deck) | |
(sort (lambda (x y) (even? (random 2))) deck)) |
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
git difftool -y -x "colordiff -y -W $COLUMNS" origin/prod origin/master | less -R |
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
section .text | |
global start | |
start: | |
mov rsi, s1 ; esi = &s1 | |
mov rdi, s2 ; edi = &s2 | |
xor rdx, rdx ; edx = 0 | |
loop: | |
mov al, [rsi + rdx] | |
mov bl, [rdi + rdx] | |
inc rdx |