Skip to content

Instantly share code, notes, and snippets.

View jlouis's full-sized avatar

Jesper Louis Andersen jlouis

View GitHub Profile
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:

@jlouis
jlouis / plot.R
Created March 9, 2016 18:04
plotty plotty
library(ggplot2)
x <- read.csv("results/all", header=TRUE)
y <- subset(x, team == "EG" | team == "EHOME" | team == "Secret" | team == 'Alliance' | team == 'OG' | team == 'VP' | team == 'VG')
p <- ggplot(y, aes(x = week, color=factor(team)))
png("out.png", x = 1920, y = 1080)
p + geom_ribbon(aes(ymin = r-2*rd, ymax=r+2*rd), fill="grey70") + geom_line(aes(y = r)) + facet_grid(team ~ .)
dev.off()
@jlouis
jlouis / output.txt
Created March 5, 2016 17:23
Genuine problem: installing a fuse reenables it
24> fuse_eqc:r(seq, {5, min}).
....................................................................................................(x10)....................................................................................................(x100)...........................................................(x10)...Failed! After 7031 tests.
[{set,{var,1},{call,fuse_eqc,elapse_time,[1667182]}},
{set,{var,2},{call,fuse_eqc,elapse_time,[1452942]}},
{set,{var,3},{call,fuse_eqc,elapse_time,[3558496]}},
{set,{var,4},{call,fuse_eqc,elapse_time,[1631202]}},
{set,{var,5},{call,fuse_eqc,remove,[isabella]}},
{set,{var,6},{call,fuse_eqc,elapse_time,[3017300]}},
{set,{var,7},{call,fuse_eqc,elapse_time,[3136209]}},
{set,{var,8},{call,fuse_eqc,elapse_time,[3336357]}},
6> eqc:module(sv_codel_eqc).
prop_codel: ...Failed! After 4 tests.
[{set,{var,1},{call,sv_codel_eqc,new,",º"}},
{set,{var,2},{call,sv_codel_eqc,advance_time,[896]}},
{set,{var,3},{call,sv_codel_eqc,delete,[]}},
{set,{var,4},{call,sv_codel_eqc,new,[29,149]}},
{set,{var,5},{call,sv_codel_eqc,advance_time,[587]}},
{set,{var,6},{call,sv_codel_eqc,advance_time,[643]}},
{set,{var,7},{call,sv_codel_eqc,len,[]}},
{set,{var,8},{call,sv_codel_eqc,advance_time,[0]}},
-module(sv_codel_eqc).
-compile([export_all]).
-include_lib("eqc/include/eqc.hrl").
-include_lib("eqc/include/eqc_statem.hrl").
-record(model, {
time,
queue,