Skip to content

Instantly share code, notes, and snippets.

Henry Till henrytill

  • Nort Route
Block or report user

Report or block henrytill

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@henrytill
henrytill / latency.markdown
Created May 23, 2017 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know
View latency.markdown

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns  = 250 µs
View landins_knot.ml
(** "Landin's Knot" - implements recursion by backpatching *)
let landins_knot f =
let r = ref (fun x -> assert false) in
let fixedpoint = f (fun x -> !r x) in
r := fixedpoint;
fixedpoint
let factorial =
let g f x =
if x = 0 then
View abt.sml
signature EQ =
sig
type t
val eq : t * t -> bool
end
signature SHOW =
sig
type t
val toString : t -> string
@henrytill
henrytill / exists.ml
Created Mar 26, 2017 — forked from jonsterling/exists.ml
existential quantifier in OCaml
View exists.ml
(* an abstract signature for instantiations of the existential quantifier *)
module type EXISTS =
sig
(* the predicate *)
type 'a phi
(* the existential type *)
type t
(* the introduction rule *)
@henrytill
henrytill / recur.ml
Created Mar 25, 2017 — forked from tel/recur.ml
Not as bad as I feared
View recur.ml
module type Functor = sig
type 'a t
val map : ('a -> 'b) -> ('a t -> 'b t)
end
module Mu (F : Functor) : sig
type t = { mu : t F.t }
val cata : ('a F.t -> 'a) -> (t -> 'a)
end = struct
@henrytill
henrytill / FAlg.ml
Created Mar 25, 2017 — forked from tel/FAlg.ml
More F-algebra things in OCaml
View FAlg.ml
module type Functor = sig
type 'a t
val map : ('a -> 'b) -> ('a t -> 'b t)
end
module Iso = struct
type ('a, 'b) t = { fwd : 'a -> 'b; bck : 'b -> 'a }
let fwd i = i.fwd
let bck i = i.bck
@henrytill
henrytill / client.hs
Created Feb 1, 2017 — forked from phadej/client.hs
Warp + http-client usage over UNIX-socket. Works with packages from LTS-6.0
View client.hs
{-# LANGUAGE OverloadedStrings #-}
import Network.HTTP.Client
import Network.HTTP.Client.Internal (Connection, openSocketConnection, makeConnection)
import Network.Socket.ByteString (sendAll, recv)
import qualified Control.Exception as E
import qualified Network.Socket as NS
main :: IO ()
@henrytill
henrytill / IAMessageSet.md
Created Aug 13, 2016 — forked from metaweta/IAMessageSet.md
Individual Agent message set proposal
View IAMessageSet.md

Message Set

Methods on Sessions

Ping and pong

  • sessionPing(sessionURI: URI)
  • sessionPong(sessionURI: URI)

Methods on Agents

createAgent

  • createAgentRequest(authType: String, authValue: String)
@henrytill
henrytill / default.nix
Created Apr 13, 2016
An OCaml environment for use with `nix-shell`
View default.nix
with import <nixpkgs> {};
let
ocamlPackages = pkgs.recurseIntoAttrs pkgs.ocamlPackages_latest;
ocamlVersion = (builtins.parseDrvName ocamlPackages.ocaml.name).version;
merlinWithEmacsMode = ocamlPackages.merlin.override { withEmacsMode = true; };
findlibSiteLib = "${ocamlPackages.findlib}/lib/ocaml/${ocamlVersion}/site-lib";
ocamlInit = pkgs.writeText "ocamlinit" ''
let () =
try Topdirs.dir_directory "${findlibSiteLib}"
View cells.clj
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
; which can be found in the file epl-v10.html at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
(set! *warn-on-reflection* true)
You can’t perform that action at this time.