Skip to content

Instantly share code, notes, and snippets.

View agumonkey's full-sized avatar

gum agumonkey

  • NONE
  • Dark side of the moon @ ['tkf8-2-1', 'ay21-3', '3263-827']
View GitHub Profile
module Main where
import Control.Monad.Writer
import System(getArgs, getProgName)
data Column = LeftCol | MiddleCol | RightCol
instance Show Column where
show LeftCol = "left"
show MiddleCol = "middle"
show RightCol = "right"
@aztek
aztek / Functor.v
Created June 11, 2012 17:11
Coq Functor type class with statically checked functor laws
Require Import Coq.Program.Basics.
Require Import Coq.Program.Syntax.
Require Import Coq.Init.Datatypes.
Require Import Coq.Unicode.Utf8.
Open Local Scope program_scope.
Open Local Scope list_scope.
Open Local Scope type_scope.
Class Functor (φ : Type → Type) := {
@sanxiyn
sanxiyn / minmax.rs
Created March 5, 2013 18:12
Minimum and Maximum
extern mod std;
fn lt<T: Ord>(a: Option<T>, b: Option<T>) -> bool {
match (a, b) {
(None, None) => false,
(None, Some(_)) => true,
(Some(_), None) => false,
(Some(a), Some(b)) => a < b
}
}
@swlaschin
swlaschin / type-dependency-graph.fsx
Last active February 27, 2025 07:40
This script analyzes the dependencies between top level types in a .NET Assembly. It is then used to compare the dependency relationships in some F# projects with those in some C# projects.
(*
This script analyzes the dependencies between top level types in a .NET Assembly.
It is then used to compare the dependency relationships in some F# projects with those in some C# projects.
Note that no attempt has been made to optimize the code yet!
REQUIRES:
* Mono.Cecil for code analysis
From http://www.mono-project.com/Cecil#Download
@danlentz
danlentz / cl-history.txt
Created June 15, 2013 22:35
Detailed account and personal insights on the history of common-lisp
From [email protected] Thu Oct 20 16:53:41 EDT 1994
Article: 15160 of comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!usenet.eel.ufl.edu!usenet.cis.ufl.edu!caen!math.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!ns.mcs.kent.edu!kira.cc.uakron.edu!malgudi.oar.net!malgudi.oar.net!welch
From: [email protected] (Arun Welch)
Newsgroups: comp.lang.lisp
Subject: CL History (was Re: Why do people like C?)
Date: 20 Oct 94 15:34:10
Organization: OARnet
Lines: 3244
Message-ID: <[email protected]>
@tavisrudd
tavisrudd / Lazy infinite streams in Bash
Last active May 23, 2017 14:30
Lazy, infinite recursive sequences in Bash (like in Haskell, if you squint). The result is ugly but interesting.
Lazy, infinite recursive sequences in Bash (like in Haskell, if you squint).
I was inspired by the beautiful Haskell zipWith implementation of the Fibonacci sequence `fibs = 0 : 1 : zipWith (+) fibs (tail fibs)`
to find an equivalent in bash using 'coroutines' and recursive pipes.
My original experiments were https://twitter.com/tavisrudd/status/367164339716751360
"fun w/ recursive pipes: e=echo;mkfifo fib;{ $e 0 1 1 >fib &};{ while read i j k; do $e $i >&2; $e $j $k $(($j+$k));sleep .4; done;}<fib>fib"
and https://twitter.com/tavisrudd/status/367142071489937408
"o=ouro;b=boros;mkfifo $o$b;e=echo; { $e $o > $o$b & }; { while read s;do $e $s>&2;case $s in $o)$e $b;;*)$e $o; esac; done; }<$o$b >$o$b"
@t-8ch
t-8ch / main.c
Created September 6, 2013 20:02
ZFS and Rust (d39cec65b025ad4c6de50e778ffd1177279b5b3d)
// Works as expected... if one gets it to compile
#include <libzfs.h>
#include <stdio.h>
#include <stdlib.h>
int zp_iter(zpool_handle_t *z, void *a) {
printf("name:\t%s\n", zpool_get_name(z));
return 0;
}
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active February 24, 2025 01:16
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@gmorpheme
gmorpheme / eval.clj
Created March 1, 2014 17:27
Lisp in Small Pieces of Clojure - chapter one
(ns ^{:doc "Evaluator from ch1 of lisp in small pieces. Warning:
NON-IDIOMATIC clojure!"}
lisp.chapter1.eval
(:refer-clojure :exclude [extend]))
(defn wrong [& msgs]
(throw (RuntimeException. (apply str msgs))))
;; -- runtime support, environments are represented as a seq of pairs,
;; -- stored in an atom. Non-idiomatic but faithful to the book.