Skip to content

Instantly share code, notes, and snippets.

View Drup's full-sized avatar

Gabriel Radanne Drup

View GitHub Profile
@atavener
atavener / database.ml
Created September 12, 2013 07:24
OCaml in-memory "database" -- I use this for component-based game-objects.
(* Database provides key-generation and table-instantiation,
* so that a key can be associated to various properties.
*)
(* This is for a fully-controlled specification...
*
* module Db = Database.Make (Database.IntKey)
* module Prop = Db.MultiInherit
* module PropHash = Prop.Table(Database.Hash)
* module Size = (val PropHash.create ~default:0 () : Db.Sig with type t = int)
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active November 11, 2024 22:46
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

@takscape
takscape / gist:df9925d0f18b2942feb2
Created September 13, 2014 02:52
Parsing with Sedlex and BatParserCo
#!/usr/bin/env ocamlscript
Ocaml.ocamlflags := ["-g"; "-thread"];
Ocaml.use_camlp4 := false;
Ocaml.packs := ["batteries"; "sedlex"]
--
open Batteries
(* Sedlex lexer definitions *)
type token =
| Number of int