Skip to content

Instantly share code, notes, and snippets.

View mikedewar's full-sized avatar

Mike Dewar mikedewar

View GitHub Profile
@mikedewar
mikedewar / vimrc
Created February 11, 2016 11:24
my vimrc as of Feb 11 2016
execute pathogen#infect()
syntax on
filetype plugin indent on
syntax enable
colorscheme monokai
" indents
set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
" backspace
@mikedewar
mikedewar / splitting.json
Created November 14, 2015 18:27
splitting
{"label":"splitting","blocks":[{"label":"","type":"get","id":2,"inputs":[{"name":"in","value":null,"type":"object"},{"name":"key","value":{"data":"a"},"type":"string"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":901,"y":393}},{"label":"","type":"delay","id":1,"inputs":[{"name":"in","value":{"data":{"a":1,"b":2}},"type":"any"},{"name":"duration","value":{"data":"1s"},"type":"string"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":692,"y":470}},{"label":"","type":"+","id":11,"inputs":[{"name":"x","value":null,"type":"number"},{"name":"y","value":{"data":1},"type":"number"}],"outputs":[{"name":"x+y","type":"number"}],"source":null,"position":{"x":1031,"y":392}},{"label":"","type":"get","id":3,"inputs":[{"name":"in","value":null,"type":"object"},{"name":"key","value":{"data":"b"},"type":"string"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":1193,"y":578}},{"label":"","type":"merge","id":6,"inputs":[{"name":"in","value":null,"type":"objec
@mikedewar
mikedewar / pubsub.json
Created November 14, 2015 04:11
pubsub
{"label":"pubsub","blocks":[{"label":"","type":"endpoint","id":8,"inputs":[{"name":"name","value":{"data":"bob"},"type":"string"}],"outputs":[{"name":"request","type":"object"},{"name":"writer","type":"writer"},{"name":"body","type":"string"}],"source":"server","position":{"x":543,"y":83}},{"label":"","type":"kvSet","id":9,"inputs":[{"name":"key","value":null,"type":"string"},{"name":"value","value":null,"type":"any"}],"outputs":[{"name":"new","type":"boolean"}],"source":"key_value","position":{"x":748,"y":153}},{"label":"","type":"kvDump","id":2,"inputs":[{"name":"dump","value":null,"type":"any"}],"outputs":[{"name":"object","type":"object"}],"source":"key_value","position":{"x":516,"y":465}},{"label":"","type":"sink","id":11,"inputs":[{"name":"in","value":null,"type":"any"}],"outputs":[],"source":null,"position":{"x":916,"y":89}},{"label":"","type":"keys","id":3,"inputs":[{"name":"in","value":null,"type":"object"}],"outputs":[{"name":"keys","type":"array"}],"source":null,"position":{"x":654,"y":589}},{"labe
@mikedewar
mikedewar / control.json
Created November 13, 2015 18:15
control flow example
{"label":"root","blocks":[{"label":"","type":"latch","id":2,"inputs":[{"name":"in","value":null,"type":"any"},{"name":"ctrl","value":null,"type":"boolean"}],"outputs":[{"name":"true","type":"any"},{"name":"false","type":"any"}],"source":null,"position":{"x":794,"y":227}},{"label":"","type":"gate","id":4,"inputs":[{"name":"in","value":null,"type":"any"},{"name":"ctrl","value":null,"type":"any"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":426,"y":228}},{"label":"ticker","type":"delay","id":1,"inputs":[{"name":"in","value":{"data":"boo"},"type":"any"},{"name":"duration","value":{"data":"1s"},"type":"string"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":490,"y":371}},{"label":"","type":"+","id":14,"inputs":[{"name":"x","value":null,"type":"number"},{"name":"y","value":{"data":1},"type":"number"}],"outputs":[{"name":"x+y","type":"number"}],"source":null,"position":{"x":433,"y":106}},{"label":"","type":"identity","id":10,"inputs":[{"name":"in","value":{"data":0},
@mikedewar
mikedewar / blockingExample.json
Last active November 14, 2015 00:12
a simple blocking example
{"label":"root","blocks":[{"label":"","type":"delay","id":13,"inputs":[{"name":"in","value":{"data":2},"type":"any"},{"name":"duration","value":{"data":"2s"},"type":"string"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":226,"y":272}},{"label":"","type":"log","id":16,"inputs":[{"name":"log","value":null,"type":"any"}],"outputs":[],"source":null,"position":{"x":777,"y":190}},{"label":"","type":"delay","id":3,"inputs":[{"name":"in","value":{"data":1},"type":"any"},{"name":"duration","value":{"data":"1s"},"type":"string"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":221,"y":159}},{"label":"","type":"set","id":22,"inputs":[{"name":"key","value":{"data":"top"},"type":"string"},{"name":"value","value":null,"type":"any"}],"outputs":[{"name":"object","type":"object"}],"source":null,"position":{"x":474,"y":146}},{"label":"","type":"set","id":23,"inputs":[{"name":"key","value":{"data":"bottom"},"type":"string"},{"name":"value","value":null,"type":"any"}],"outputs":[{"n
@mikedewar
mikedewar / PoissonProcess.json
Created November 11, 2015 14:39
a streamtools pattern describing a poisson process
{"label":"root","blocks":[{"label":"","type":"exponential","id":1,"inputs":[{"name":"rate","value":{"data":1},"type":"number"}],"outputs":[{"name":"draw","type":"number"}],"source":null,"position":{"x":263,"y":345}},{"label":"","type":"delay","id":2,"inputs":[{"name":"in","value":{"data":1},"type":"any"},{"name":"duration","value":null,"type":"string"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":578,"y":330}},{"label":"","type":"toString","id":4,"inputs":[{"name":"in","value":null,"type":"any"}],"outputs":[{"name":"out","type":"string"}],"source":null,"position":{"x":387,"y":345}},{"label":"","type":"concat","id":5,"inputs":[{"name":"a","value":null,"type":"string"},{"name":"b","value":{"data":"s"},"type":"string"}],"outputs":[{"name":"a+b","type":"string"}],"source":null,"position":{"x":486,"y":345}},{"label":"","type":"log","id":9,"inputs":[{"name":"log","value":null,"type":"any"}],"outputs":[],"source":null,"position":{"x":713,"y":330}}],"connections":[{"from":{"id":2,"route":0},
@mikedewar
mikedewar / counter.json
Created November 10, 2015 19:51
streamtools counter
{"label":"root","blocks":[{"label":"","type":"latch","id":1,"inputs":[{"name":"in","value":null,"type":"any"},{"name":"ctrl","value":null,"type":"boolean"}],"outputs":[{"name":"true","type":"any"},{"name":"false","type":"any"}],"source":null,"position":{"x":358,"y":348}},{"label":"","type":"first","id":2,"inputs":[{"name":"in","value":null,"type":"any"}],"outputs":[{"name":"first","type":"boolean"}],"source":null,"position":{"x":249,"y":417}},{"label":"","type":"identity","id":4,"inputs":[{"name":"in","value":{"data":0},"type":"any"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":147,"y":320}},{"label":"","type":"delay","id":10,"inputs":[{"name":"in","value":{"data":true},"type":"any"},{"name":"duration","value":{"data":"1s"},"type":"string"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":367,"y":544}},{"label":"","type":"gate","id":11,"inputs":[{"name":"in","value":null,"type":"any"},{"name":"ctrl","value":null,"type":"any"}],"outputs":[{"name":"out","type":"an
@mikedewar
mikedewar / initialCondition.json
Created November 10, 2015 19:47
a streamtools pattern that emits an initial condition
{"label":"root","blocks":[{"label":"","type":"latch","id":1,"inputs":[{"name":"in","value":null,"type":"any"},{"name":"ctrl","value":null,"type":"boolean"}],"outputs":[{"name":"true","type":"any"},{"name":"false","type":"any"}],"source":null,"position":{"x":366,"y":322}},{"label":"","type":"first","id":2,"inputs":[{"name":"in","value":null,"type":"any"}],"outputs":[{"name":"first","type":"boolean"}],"source":null,"position":{"x":253,"y":383}},{"label":"","type":"identity","id":4,"inputs":[{"name":"in","value":null,"type":"any"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":180,"y":296}},{"label":"","type":"identity","id":7,"inputs":[{"name":"in","value":null,"type":"any"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":509,"y":314}}],"connections":[{"from":{"id":2,"route":0},"to":{"id":1,"route":1},"id":3},{"from":{"id":4,"route":0},"to":{"id":1,"route":0},"id":5},{"from":{"id":4,"route":0},"to":{"id":2,"route":0},"id":6},{"from":{"id":1,"route":0},"to":{"id":7,
@mikedewar
mikedewar / Fibonacci.json
Created November 10, 2015 19:18
Fibonacci Sequence in streamtools
{"blocks":[{"label":"","type":"identity","id":1,"inputs":[{"name":"in","value":null,"type":"any"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":295,"y":325}},{"label":"","type":"+","id":2,"inputs":[{"name":"x","value":null,"type":"number"},{"name":"y","value":{"data":1},"type":"number"}],"outputs":[{"name":"x+y","type":"number"}],"source":null,"position":{"x":293,"y":203}},{"label":"","type":"latch","id":3,"inputs":[{"name":"in","value":null,"type":"any"},{"name":"ctrl","value":null,"type":"boolean"}],"outputs":[{"name":"true","type":"any"},{"name":"false","type":"any"}],"source":null,"position":{"x":191,"y":133}},{"label":"","type":"first","id":4,"inputs":[{"name":"in","value":null,"type":"any"}],"outputs":[{"name":"first","type":"any"}],"source":null,"position":{"x":133,"y":231}},{"label":"","type":"identity","id":5,"inputs":[{"name":"in","value":{"data":0},"type":"any"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":62,"y":133}},{"label":"","type":"^","id":6
@mikedewar
mikedewar / ar2.json
Created November 10, 2015 19:16
AR(2) model in streamtools
{"blocks":[{"label":"a","type":"*","id":1,"inputs":[{"name":"x","value":null,"type":"number"},{"name":"y","value":{"data":0.99},"type":"number"}],"outputs":[{"name":"x*y","type":"number"}],"source":null,"position":{"x":1103,"y":564}},{"label":"yt","type":"identity","id":4,"inputs":[{"name":"in","value":null,"type":"any"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":926,"y":661}},{"label":"","type":"delay","id":6,"inputs":[{"name":"in","value":null,"type":"any"},{"name":"duration","value":{"data":"1s"},"type":"string"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":941,"y":871}},{"label":"","type":"latch","id":9,"inputs":[{"name":"in","value":null,"type":"any"},{"name":"ctrl","value":null,"type":"boolean"}],"outputs":[{"name":"true","type":"any"},{"name":"false","type":"any"}],"source":null,"position":{"x":572,"y":690}},{"label":"","type":"first","id":10,"inputs":[{"name":"in","value":null,"type":"any"}],"outputs":[{"name":"first","type":"any"}],"source":null,"