Skip to content

Instantly share code, notes, and snippets.

View jlouis's full-sized avatar

Jesper Louis Andersen jlouis

View GitHub Profile
.PHONY: foo
ifdef Y
X := "Yes"
else
X := "No"
endif
foo:
@echo ${Y}
@jlouis
jlouis / z.erl
Created November 15, 2016 20:34
merge3
-module(z).
-export([t/0, merge/3]).
merge(F, L, R) ->
L1 = lists:sort(maps:to_list(L)),
L2 = lists:sort(maps:to_list(R)),
merge(F, L1, L2, []).
merge(_F, [], [], Acc) -> maps:from_list(Acc);
Standard ML of New Jersey v110.80 [built: Sun Sep 25 12:16:08 2016]
- fun f n = f (n+1);
val f = fn : int -> 'a
- f 0;
stdIn:2.1-2.4 Warning: type vars not generalized because of
value restriction are instantiated to dummy types (X1,X2,...)
uncaught exception Overflow [overflow]
raised at: <file stdIn>
@jlouis
jlouis / z.ml
Last active July 20, 2016 21:22
#require "core";;
#require "ppx_fields_conv";;
#use "z.ml";;
type t = { tag : bool; }
val tag : t -> bool = <fun>
module Fields :
sig
val names : string list
val tag : ([< `Read | `Set_and_create ], t, bool) Field.t_with_perm
val make_creator :
import asynchttpserver, asyncdispatch, strtabs
var server = newAsyncHttpServer()
proc cb(req: Request) {.async.} =
await req.respond(Http200, "CHAPTER I. Down the Rabbit-Hole Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, <and what is the use of a book,> thought Alice <without pictures or conversations?> So she was considering in her own mind (as well as she could, for the hot day made her feel very sleepy and stupid), whether the pleasure of making a daisy-chain would be worth the trouble of getting up and picking the daisies, when suddenly a White Rabbit with pink eyes ran close by her. There was nothing so very remarkable in that; nor did Alice think it so very much out of the way to hear the Rabbit say to itself, <Oh dear! Oh dear! I shall be late!> (when she thought it over afterwards, it occurred to her that she ought to have wond
-module(z_app).
-behaviour(application)
-export([start/2, prep_stop/1]).
start(_StartType, _StartArgs) ->
{ok, Pid} = z_sup:start_link(),
Dispatch = …,
cowboy:start_http(z_app_listener, 100,
107> fuse_cluster:t(60).
....................................................................................................(x10)....................................................................................................(x100)..............................................................................(x10)...(x1)........
Time limit reached: 60.0 seconds.
OK, passed 8938 tests
Commands
69.653% {fuse_time_eqc,advance_time,1}
8.077% {fuse_eqc,install,2}
7.973% {fuse_eqc,remove,1}
@jlouis
jlouis / output.txt
Created March 28, 2016 15:22
What should happen to a timer when you administratively disable a fuse?
Shrinking xxxxxx.xx.xxx.x.x.x.x..x.xx.xxxxxxxxxxx(10 times)
[{set,
{var,1},
{call,fuse_eqc,install,
[vanessa,{{standard,1,1},{reset,60000}}],
[{id,1},
{self,{var,{pid,root}}},
{res,ok},
{callouts,
{seq,
-module(z).
-compile(export_all).
f(X) ->
case X of
<<"A">> -> ok;
<<"B">> -> ok
end.
@jlouis
jlouis / output.md
Created March 11, 2016 19:23
Typical awesome scenarios caught for QuickCheck in jlouis/fuse

Switching:

  1. Install a standard fuse
  2. Install a fault_injection fuse which overrides the standard fuse

Notice that the ETS table is not updated correct for step 2.

Disabling: