Skip to content

Instantly share code, notes, and snippets.

@dbuenzli
dbuenzli / opam #4445
Created December 19, 2020 09:50
opam #4445
> opam switch create 4.06.0 --debug-level=3
00:00.003 GSTATE LOAD-GLOBAL-STATE @ /Users/dbuenzli/.opam
00:00.004 SYSTEM LOCK /Users/dbuenzli/.opam/lock (none => read)
00:00.004 SYSTEM LOCK /Users/dbuenzli/.opam/config.lock (none => write)
00:00.004 FILE(config) Read ~/.opam/config in 0.000s
00:00.005 RSTATE LOAD-REPOSITORY-STATE @ /Users/dbuenzli/.opam
00:00.008 FILE(repos-config) Read ~/.opam/repo/repos-config in 0.003s
00:00.008 SYSTEM LOCK /Users/dbuenzli/.opam/repo/state.cache (none => read)
00:00.108 RSTATE Loaded /Users/dbuenzli/.opam/repo/state.cache in 0.099s
00:00.264 SYSTEM LOCK /Users/dbuenzli/.opam/repo/state.cache (read => none)
@dbuenzli
dbuenzli / landmark.md
Created October 22, 2020 21:40
How to landmark
echo 'true : package(landmarks.ppx,landmarks)' >> _tags
export OCAML_LANDMARK=auto
topkg build 

topkg run exe

@dbuenzli
dbuenzli / ocaml-deprecate.md
Last active November 11, 2019 12:00
Deprecation procedure for OCaml

Deprecation procedure for OCaml

In order to deprecate a feature from the OCaml system the following steps are taken:

  1. Introduce a workaround for the deprecation (if needed). Document the workaround, see below.
  2. When Debian stable has the version in which the workaround was introduced, start deprecating the feature with a visible warning
@dbuenzli
dbuenzli / readmeta.ml
Last active October 15, 2019 16:33
Read cma/cmxa/cmxs link metadata
(*
ocamlfind ocamlopt -o readmeta -linkpkg \
-package dynlink,compiler-libs.optcomp,compiler-libs.bytecomp readmeta.ml
*)
let read_cma ic =
let lib =
let toc_pos = input_binary_int ic in
seek_in ic toc_pos;
(input_value ic : Cmo_format.library)
@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 / ioserial.ml
Last active April 12, 2019 12:39
Serial connection
(*----------------------------------------------------------------------------
Copyright (c) 2009, Daniel C. Bünzli. All rights reserved.
Distributed under a BSD license, see license at the end of the file.
----------------------------------------------------------------------------*)
let str = Printf.sprintf
let exec = Filename.basename Sys.executable_name
let pr = Format.printf
let pr_err s = Printf.eprintf "%s:%s\n" exec s
@dbuenzli
dbuenzli / opam
Last active January 17, 2018 18:04
opam-set-env
opam-version: "2.0"
synopsis: "Build setenv"
maintainer: "Daniel Bünzli <daniel.buenzl i@erratique.ch>"
setenv: [[BLA += "BLA"]]
authors:[]
build:[[ "env" ]]
@dbuenzli
dbuenzli / opam
Created January 12, 2018 22:25
opam-build-env
opam-version: "2.0"
synopsis: "Build environment"
maintainer: "Daniel Bünzli <daniel.buenzl i@erratique.ch>"
authors:[]
build:[[ "env" ]]
@dbuenzli
dbuenzli / Vagrantfile
Created December 21, 2017 23:48
Install OCaml 4.06 in a Win10 VM with vagrant
# Download vagrant box for Windows 10 from:
#
# https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/
#
# Unzip and add with:
#
# vagrant box add --name win10 MSEdge\ -\ Win10.box
#
# During the first `vagrant up` need to connect to vm UI to do this:
#
@dbuenzli
dbuenzli / opam-v2-switch-init.md
Created July 16, 2017 23:06
opam v2 switch init

Switch creation and initialization in opam v2.

The first point for me is that we should as much as possible get to a system where the following basic sequences of steps are possible.

opam switch create bla               # Create switch
opam install non-ocaml-pkg           # Doesn't depend on ocaml
opam install ocaml.V.VV.V+variant

or