Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
"""
Usage: git-blame-tags <path>
Annotate lines of <path> with the oldest tag each line is contained in.
"""
from functools import cache
import os.path
import subprocess
@emillon
emillon / bench.ml
Created September 23, 2021 15:58
openssl vs digestif
external openssl_sha1 : string -> string = "camlopenssl_sha1"
external openssl_blake2b : string -> string = "camlopenssl_blake2b"
let bench_sha1 () =
let input_len = 100_000 in
let input = String.make input_len ' ' in
let run_digestif () = Digestif.SHA1.digest_string input in
let run_openssl () = openssl_sha1 input |> Digestif.SHA1.of_raw_string in
Benchmark.throughputN 1
@emillon
emillon / ExampleCodemod.re
Created November 27, 2018 12:23
2018-11-26 Reason Language Server codemod example
open Parsetree;
open Codemod.Helpers;
let replaceErrors = (ctx, expr) =>
expr
->mapExpr((mapper, expr) => {
switch (expr.pexp_desc) {
| Pexp_construct({txt: Longident.Lident("Student")} as lid, Some({pexp_desc: Pexp_tuple([name, age])})) =>
let loc = Location.none
(* Step 1: 'a list -> bool everywhere. *)
(* Step 2: Wrap in a newtype: Finder of 'a list -> bool *)
(* Step 3: abstract in a module with this signature *)
module type LIST_FINDER = sig
type 'a t
val this_element : 'a -> 'a t
@emillon
emillon / bitoduc.sh
Created December 8, 2015 09:59
bitoduc.fr CLI client
#!/bin/sh
url=bitoduc.fr/traductions.json
jq='[.["vrais mots"] + .["faux mots"] | .[] | {(.anglais): .francais}]|add|.[$mot]'
curl -s "$url" | jq "$jq" -r --arg mot "$1"
Binary files ocaml-3.12.0/.DS_Store and ocaml-diff/.DS_Store differ
diff -urN ocaml-3.12.0/.depend ocaml-diff/.depend
--- ocaml-3.12.0/.depend 2010-07-23 17:30:37.000000000 +0200
+++ ocaml-diff/.depend 2012-03-14 14:42:30.000000000 +0100
@@ -291,12 +291,17 @@
bytecomp/bytepackager.cmi: typing/ident.cmi
bytecomp/bytesections.cmi:
bytecomp/cmo_format.cmi: bytecomp/lambda.cmi typing/ident.cmi
+bytecomp/covevent.cmi: typing/types.cmi parsing/location.cmi
+bytecomp/covutils.cmi: typing/typedtree.cmi typing/primitive.cmi \
@emillon
emillon / README.md
Last active August 29, 2015 14:02
Logos

Logos vectoriels pour:

  • APR
  • LIP6
  • UPMC
  • CNRS
@emillon
emillon / jussieu.geojson
Created February 12, 2014 11:56
Où manger après le spectacle ?
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@emillon
emillon / ytrw.py
Created August 9, 2012 10:11
Random Walk on Youtube
#!/usr/bin/env python
import random
import sys
import urllib2
from bs4 import BeautifulSoup
def video_open(vid):
url = 'http://www.youtube.com' + vid
return urllib2.urlopen(url)
// ==UserScript==
// @match http://*.wikipedia.org/wiki/*
// This was written by Etienne Millon <etienne.millon@gmail.com>
//
// Replace Jimmy Wales' "donate now" pics by kittens.
// ==/UserScript==
function replaceJimmy() {
var img = $("img[alt='Jimmy Wales']")[0];
var url = 'http://placekitten.com/'+img.width+'/'+img.height;