Skip to content

Instantly share code, notes, and snippets.

@b0oh
b0oh / lamb.scm
Last active June 13, 2018 20:31
Factorial from nothing
(let ((true (lambda (true false) true))
(false (lambda (true false) false))
(and (lambda (pred1 pred2) (pred1 pred2 pred1)))
(if (lambda (pred true false) (pred true false)))
(+1 (lambda (num succ zero) (succ (num succ zero))))
(+ (lambda (num1 num2 succ zero) (num1 succ (num2 succ zero))))
(* (lambda (num1 num2 succ zero) (num1 (num2 succ) zero)))
(^ (lambda (num1 num2) (num2 num1)))
(-1 (lambda (num succ pred)
(num (lambda (g h) (h (g succ)))
@b0oh
b0oh / Makefile
Created May 21, 2018 00:36 — forked from codedot/Makefile
Bitcoin proof of work in pure lambda calculus
all:
node work2mlc.js getwork.json 381353fa >test.mlc
lambda -pem lib.mlc -f test.mlc
clean:
@b0oh
b0oh / fftutorial.cs
Created February 3, 2017 23:48 — forked from Lovesan/fftutorial.cs
FFmpeg & SDL2 - play audio & video
#define __STDC_CONSTANT_MACROS
#include <stdint.h>
#include <inttypes.h>
#include <windows.h>
#include <stdio.h>
extern "C"
{
#include <libavfilter/avfilter.h>
@b0oh
b0oh / typing.md
Created November 21, 2016 11:19 — forked from chrisdone/typing.md
Typing Haskell in Haskell

Typing Haskell in Haskell

MARK P. JONES

Pacific Software Research Center

Department of Computer Science and Engineering

Oregon Graduate Institute of Science and Technology

@b0oh
b0oh / userscript.js
Last active August 29, 2015 14:01
DuckDuckGo Explicit Userscript
// ==UserScript==
// @name DuckDuckGo Explicit
// @namespace https://gist.github.com/b0oh/01354c52e2b66ccbf7a8
// @include https://duckduckgo.com/*
// @version 1
// @grant none
// ==/UserScript==
$(document).ready(function () {
var results = $('.results');
@b0oh
b0oh / index.erl
Created June 5, 2013 11:31
Simpliest Chat Ever
-module(index).
-export([main/0, title/0, body/0, event/1]).
-include_lib("nitrogen_core/include/wf.hrl").
-include("records.hrl").
main() -> #template { file="./site/templates/bare.html" }.
title() -> "Simple Chat".
body() ->
module dff_async_reset (
input wire reset,
input wire clock,
input wire [7:0] input_data,
output reg [7:0] output_data
);
always @(posedge clock or posedge reset)
if (reset)
output_data <= 0;
@b0oh
b0oh / Fantom.hs
Last active December 15, 2015 19:29
module Fantom where
data NoPower
data Power
data Product = Donut | Bread deriving Show
data Oven product power = Oven product
oven :: Product -> Oven Product NoPower
@b0oh
b0oh / gist:4177081
Created November 30, 2012 17:11
Church Numerals on CoffeeScript
# helpers
inc = (x) -> x + 1
church = (n) ->
if n > 0
succ church n-1
else
zero