Skip to content

Instantly share code, notes, and snippets.

View mseri's full-sized avatar
👻
Always with you with the MTGAP 2.0 keyboard layout

Marcello Seri mseri

👻
Always with you with the MTGAP 2.0 keyboard layout
View GitHub Profile
@mseri
mseri / reachable.ml
Created October 30, 2018 12:52
How pkcs11 is solving the issue of ctypes Carray lifetimes
module Reachable_ptr : sig
type 'a t
val typ : 'a Ctypes_static.typ -> 'a t Ctypes_static.typ
val setf : ('b, 'c) Ctypes.structured ->
('a t, ('b, 'c) Ctypes.structured) Ctypes.field -> 'a Ctypes.ptr -> unit
val getf : ('b, 'c) Ctypes.structured ->
('a t, ('b, 'c) Ctypes.structured) Ctypes.field -> 'a Ctypes.ptr
end = struct
@mseri
mseri / freeap.ml
Created July 8, 2017 17:40 — forked from leque/freeap.ml
Free Applicative Functors in OCaml
open Higher
(*
See `Free Applicative Functors' http://arxiv.org/abs/1403.0749
*)
type (_, _) t =
| Pure : 'a -> ('a, 'f) t
| Apply : ('a -> 'b, 'f) t * ('a, 'f) app -> ('b, 'f) t
let pure v = Pure v
@mseri
mseri / rtt.ml
Created July 8, 2017 17:39 — forked from leque/rtt.ml
(* See also: http://caml.inria.fr/pub/docs/manual-ocaml/extn.html#sec238 *)
type _ typ =
| Unit : unit typ
| Int : int typ
| Float : float typ
| String : string typ
| Pair : ('a typ * 'b typ) -> ('a * 'b) typ
| List : 'a typ -> 'a list typ
@mseri
mseri / freer.ml
Created July 8, 2017 17:38 — forked from leque/freer.ml
Freer monad in OCaml
(*
Requirement: higher, ppx_deriving.show
*)
(*
Lightweight higher-kinded polymorphism
https://ocamllabs.github.io/higher/lightweight-higher-kinded-polymorphism.pdf
*)
open Higher
@mseri
mseri / gen.ml
Created May 25, 2017 21:39 — forked from dbuenzli/gen.ml
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
@mseri
mseri / Vagrantfile
Last active April 19, 2017 09:45 — forked from jonludlam/Vagrantfile
Vagrantfile for xapi development
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
config.vm.box = "boxcutter/ubuntu1604-desktop"

Keybase proof

I hereby claim:

  • I am mseri on github.
  • I am mseri (https://keybase.io/mseri) on keybase.
  • I have a public key whose fingerprint is 4DFF F06D F74F DE5E 6AD4 B2F7 05C0 CD01 5D10 C4B4

To claim this, I am signing this object:

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mseri
mseri / Vagrantfile
Last active August 29, 2015 14:23
Nix ready debian-jesse-base vagrant box
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "debian/jessie64"
config.vm.network "forwarded_port", guest: 80, host: 9090
config.vm.synced_folder "data", "/shared_data"
# Install nixos package manager - nix - (for provisioning purposes?)
@mseri
mseri / gen_article.py
Created June 2, 2015 14:44
Generates a stub for a markdown pelican article.
#!/usr/bin/env python3
"""Generates a stub for a markdown pelican article."""
import click
from datetime import datetime
from os import listdir
TEMPLATE = """Id: {aid}
Title: {title}