Skip to content

Instantly share code, notes, and snippets.

Helping companies market and sell more software

Michael Bernstein mrb

Helping companies market and sell more software
View GitHub Profile
thezerobit / prolog peano
Created Jan 5, 2014
Peano relation in Prolog using the CLP(FD) that ships with SWI-Prolog.
View prolog peano
:- use_module(library(clpfd)).
peano(N,z) :- N #= 0.
peano(N,s(PDec)) :-
N #> 0,
N - 1 #= NDec,
peano(NDec, PDec).
% ?- peano(4, Q).
% Q = s(s(s(s(z)))) ;
View gist:8265340
(load "mkprelude.scm")
(define peanoo
(lambda (n out)
[(== n (build-num 0)) (== '(O) out)]
[(fresh (n1 res)
(-o n (build-num 1) n1)
(conso 'S res out)
(peanoo n1 res))])))
bryanwoods / favoritebooks.txt
Created Dec 17, 2013
My favorite books I read in 2013, alphabetical by author's name
View favoritebooks.txt
The Verificationist - Donald Antrim
what purpose did i serve in your life - Marie Calloway
The Last Samurai - Helen DeWitt
The White Album - Joan Didion
The Orphan Master's Son - Adam Johnson
Taipei - Tao Lin
The Twelve Tribes of Hattie - Ayana Mathis
The Road - Cormac McCarthy
Swamplandia! - Karen Russell
Journalism - Joe Sacco
View gist:7965505
(ns knossos.redis
(:use knossos.core))
;; System state
(defn node
"A node consists of a register, a primary it replicates from, whether it is
isolated from all other nodes, a local replication offset, and if it is a
primary, a map of node names to known replication offsets."
patrickt / Overture.hs
Created Sep 26, 2013
A drop-in replacement for the Haskell Prelude.
View Overture.hs
module Prelude.Overture
( module X
-- Haskell 98 stuff is easier to get at through the Prelude
-- than through the GHC-specific modules
import Prelude as X ( Bounded (..)
, Enum (..)
, Floating (..)
ericmoritz / .gitignore
Last active Dec 21, 2015
A simple Haskell program to bump a semantic version number by 1
View .gitignore
View radical.cljs
(ns async-test.core
(:require [cljs.core.async :refer [chan]]
[clojure.string :as string])
[cljs.core.async.macros :as m :refer [go alt! alts!]]))
(def c (chan))
(def loc-div (.getElementById js/document "location"))
(.addEventListener js/window "mousemove"
View throttle
# Bandwidth throttling for OSX,
case "$1" in
echo Throttling at $KB Kbytes/s
sudo ipfw pipe 1 config bw "$KB"KByte/s
View macro.erl
-define(case_inf(E, E0, FC, E1, AC, E2, A, F, E3),
AInf = (E),
not AInf ->
is_function(AInf) ->
FC = AInf,
is_tuple(AInf) andalso size(AInf) == 2 andalso is_function(element(2,AInf)) ->
mrb / coll.rkt
Last active Dec 17, 2015
Annoted mark and sweep collector in Racket, with the test code removed. From
View coll.rkt
#lang plai/collector
;; A tri-color mark and sweep algorithm. There are three sets of heap nodes:
;; gray, white, and black. Black nodes are known to not be garbage or hold
;; references to garbage, gray nodes are known to not be garbage but their
;; references have not been checked, and white nodes, the rest, are garbage.
;; * The black set begins empty
;; * The gray set begins with the roots
;; * All non root nodes begin in the white set
;; * Iterate over the gray set. "Blacken" each node by "graying" the nodes
You can’t perform that action at this time.