Skip to content

Instantly share code, notes, and snippets.

@dbuenzli
dbuenzli / gen.ml
Last active June 11, 2022 18:13
OCaml simple generators
(*---------------------------------------------------------------------------
Copyright (c) 2015 Daniel C. Bünzli. All rights reserved.
Distributed under the BSD3 license, see license at the end of the file.
%%NAME%% release %%VERSION%%
---------------------------------------------------------------------------*)
(* Simple generators according to:
Kiselyov, Peyton-Jones, Sabry
Lazy v. Yield: Incremental, Linear Pretty-printing
@dbuenzli
dbuenzli / watch.ml
Last active August 29, 2015 14:16
watch.ml
open Rresult_infix
open Bos_unix
(* Watch a directory for changes. First run will create a database
watchdb in the directory with modification times. Subsquent runs
will check files against that database. *)
module Db = struct
let db_file = Path.file "watchdb"
let exists () = OS.File.exists db_file
@dbuenzli
dbuenzli / ocp-index-conflict.cudf
Created October 27, 2014 10:59
cudf ocp-index conflict
# aspcud /Users/dbuenzli/sync/repos/vg/$in /Users/dbuenzli/sync/repos/vg/$out -removed,-notuptodate,-changed
preamble:
property: pinned: bool = [false], installed-root: bool = [false], reinstall: bool = [false], opam-version: string, opam-name: string
package: conf-python-2-7
version: 1
conflicts: conf-python-2-7
opam-name: conf-python-2-7
opam-version: 1.0
@dbuenzli
dbuenzli / min.html
Created August 26, 2014 18:34
Hashtbl values disappearing in Safari
<!DOCTYPE html>
<!--
This code is in the public domain.
-->
<html lang="en">
<head>
<meta charset="utf-8">
<script type="text/javascript" defer="defer" src="min.js"></script>
<title>Vgr_htmlc minimal example</title>
</head>
@dbuenzli
dbuenzli / merlin.log
Created August 24, 2014 15:25
merlin hang
{"time":0.0,"level":"info","section":"general","title":"monitor start","content":["general","info"]}
{"time":0.0,"level":"info","section":"general","title":"available logging sections","content":["general","command","parser","locate","recover","protocol"]}
{"time":0.0,"level":"info","section":"general","title":"monitor start","content":["protocol","info"]}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.005412,"delta":0.0011029999999999998,"body":["project","find","/Users/dbuenzli/gg/src/gg.ml"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.0054789999999999995,"delta":6.699999999999935e-05,"body":["return",{"result":[]}]}}
{"time":0.0,"level":"info","section":"protocol","title":"input","content":{"time":0.005525,"delta":4.60000000000009e-05,"body":["reset","ml","/Users/dbuenzli/gg/src/gg.ml"]}}
{"time":0.0,"level":"info","section":"protocol","title":"output","content":{"time":0.005885,"delta":0.0003599999999999992,"body":["return",{"
@dbuenzli
dbuenzli / problem.cudf
Created July 31, 2014 16:16
opam beta2 solver issue
# aspcud /Users/dbuenzli/tmp/opam-1.2.0-beta2/$in /Users/dbuenzli/tmp/opam-1.2.0-beta2/$out -count(removed),-notuptodate(request),-count(down),-count(changed)
preamble:
property: pinned: bool = [false], installed-root: bool = [false], reinstall: bool = [false], opam-version: string, opam-name: string
package: herelib
version: 3
depends: ocamlfind , camlp4
conflicts: herelib
opam-name: herelib
opam-version: 109.10.00
@dbuenzli
dbuenzli / Info.plist
Last active August 29, 2015 14:03
Build osx bundle
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key><string>Test</string>
<key>CFDisplayName</key><string>Test</string>
<key>CFBundleIdentifier</key><string>org.example.Test</string>
<key>CFBundlePackageType</key><string>APPL</string>
<key>CFBundleSignature</key><string>????</string>
<key>CFBundleVersion</key><string>%%VERSION%%</string>
@dbuenzli
dbuenzli / pkgs
Created June 25, 2014 20:03
opam pkg list
asn1-combinators 0.0.1 installed
base-bigarray base root
base-threads base root
base-unix base root
bin_prot 111.03.00 installed
biniou 1.0.9 installed
bytes 1.1 installed
camlp4 4.01.0 installed
camlzip 1.05 installed
cmdliner 0.9.4 installed
@dbuenzli
dbuenzli / safari-trace
Created June 20, 2014 13:26
safari-trace
((state-in((handshake((version TLS_1_2)(machina(Server ServerInitial))(config((ciphers(TLS_RSA_WITH_AES_256_CBC_SHA TLS_DHE_RSA_WITH_AES_256_CBC_SHA TLS_RSA_WITH_AES_128_CBC_SHA TLS_DHE_RSA_WITH_AES_128_CBC_SHA TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA TLS_RSA_WITH_3DES_EDE_CBC_SHA TLS_RSA_WITH_RC4_128_SHA TLS_RSA_WITH_RC4_128_MD5))(version(TLS_1_2 TLS_1_0))(hashes(SHA512 SHA384 SHA256 SHA MD5))(use_rekeying true)(requre_sec_rek true)(validator())(peer_name())(certificate(<CERTIFICATE>))))(rekeying())(hs_fragment())))(decryptor())(encryptor())(fragment())))(record-in(((content_type HANDSHAKE)(version TLS_1_0))((01 00 00 a7 03 03 53 a4 35 6e 8c 09 82 3e 46 16)(f6 bc f5 40 94 b7 e3 80 30 c0 83 c2 cd b7 02 55)(87 9f b1 b2 19 58 00 00 4a 00 ff c0 24 c0 23 c0)(0a c0 09 c0 07 c0 08 c0 28 c0 27 c0 14 c0 13 c0)(11 c0 12 c0 26 c0 25 c0 2a c0 29 c0 05 c0 04 c0)(02 c0 03 c0 0f c0 0e c0 0c c0 0d 00 3d 00 3c 00)(2f 00 05 00 04 00 35 00 0a 00 67 00 6b 00 33 00)(39 00 16 01 00 00 34 00 00 00 0e 00 0c 00 00 09)(31 32 37 2e 30 2e 30
@dbuenzli
dbuenzli / sdl-install.sh
Created May 18, 2014 23:19
SDL install script
#!/bin/sh -ex
V=2.0.3
curl -OL http://www.libsdl.org/release/SDL2-${V}.tar.gz
tar -zxvf SDL2-${V}.tar.gz
cd SDL2-${V}
sudo apt-get install build-essential mercurial make cmake autoconf automake \
libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \
libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \
libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \