Skip to content

Instantly share code, notes, and snippets.

@sophia-ooo
sophia-ooo / histogram.md
Created November 15, 2015 19:15
generate histogram
{"label":"root","blocks":[{"label":"","type":"exponential","id":7,"inputs":[{"name":"rate","value":{"data":1},"type":"number"}],"outputs":[{"name":"draw","type":"number"}],"source":null,"position":{"x":18,"y":143}},{"label":"","type":"toString","id":8,"inputs":[{"name":"in","value":null,"type":"any"}],"outputs":[{"name":"out","type":"string"}],"source":null,"position":{"x":141,"y":143}},{"label":"","type":"concat","id":9,"inputs":[{"name":"a","value":null,"type":"string"},{"name":"b","value":{"data":"ms"},"type":"string"}],"outputs":[{"name":"a+b","type":"string"}],"source":null,"position":{"x":240,"y":143}},{"label":"","type":"delay","id":10,"inputs":[{"name":"in","value":{"data":1},"type":"any"},{"name":"duration","value":null,"type":"string"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":332,"y":128}},{"label":"","type":"*","id":11,"inputs":[{"name":"x","value":{"data":2},"type":"number"},{"name":"y","value":null,"type":"number"}],"outputs":[{"name":"x*y","type":"number"}],"sou
@sophia-ooo
sophia-ooo / countblock.md
Last active November 16, 2015 00:42
countblock.md
{"label":"root","blocks":[{"label":"","type":"exponential","id":71,"inputs":[{"name":"rate","value":{"data":1},"type":"number"}],"outputs":[{"name":"draw","type":"number"}],"source":null,"position":{"x":18,"y":143}},{"label":"","type":"toString","id":73,"inputs":[{"name":"in","value":null,"type":"any"}],"outputs":[{"name":"out","type":"string"}],"source":null,"position":{"x":141,"y":143}},{"label":"","type":"concat","id":74,"inputs":[{"name":"a","value":null,"type":"string"},{"name":"b","value":{"data":"ms"},"type":"string"}],"outputs":[{"name":"a+b","type":"string"}],"source":null,"position":{"x":240,"y":143}},{"label":"","type":"delay","id":72,"inputs":[{"name":"in","value":{"data":1},"type":"any"},{"name":"duration","value":null,"type":"string"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":332,"y":128}},{"label":"","type":"*","id":311,"inputs":[{"name":"x","value":{"data":2},"type":"number"},{"name":"y","value":null,"type":"number"}],"outputs":[{"name":"x*y","type":"number"}],
@sophia-ooo
sophia-ooo / countblock.md
Created November 15, 2015 17:57
count block
{"label":"root","blocks":[{"label":"","type":"exponential","id":71,"inputs":[{"name":"rate","value":{"data":1},"type":"number"}],"outputs":[{"name":"draw","type":"number"}],"source":null,"position":{"x":18,"y":143}},{"label":"","type":"toString","id":73,"inputs":[{"name":"in","value":null,"type":"any"}],"outputs":[{"name":"out","type":"string"}],"source":null,"position":{"x":141,"y":143}},{"label":"","type":"concat","id":74,"inputs":[{"name":"a","value":null,"type":"string"},{"name":"b","value":{"data":"s"},"type":"string"}],"outputs":[{"name":"a+b","type":"string"}],"source":null,"position":{"x":240,"y":143}},{"label":"","type":"delay","id":72,"inputs":[{"name":"in","value":{"data":1},"type":"any"},{"name":"duration","value":null,"type":"string"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":332,"y":128}},{"label":"","type":"pqLen","id":62,"inputs":[{"name":"trigger","value":null,"type":"any"}],"outputs":[{"name":"length","type":"number"}],"source":"priority-queue","position":{"x
@sophia-ooo
sophia-ooo / gist:db148ad236f485fce806
Last active July 14, 2020 04:53
Share Whatever over Google Tone
// send whatever message you want over Google Tone
// as far as I can tell, profile images must live on googleusercontent.com
// data.url must look like a url
// setting AUDIBLE_DURATION to 1 will generate no audible sound but result in a successful transmission.
//
// to use:
// 0. install Google Tone https://chrome.google.com/webstore/detail/google-tone/nnckehldicaciogcbchegobnafnjkcne
// 1. open settings > extentions
// 2. click "options" under Google Tone
// 3. In the Google Tone options, open the developer console and paste the following
@sophia-ooo
sophia-ooo / gist:96ff755cb129334c2145
Created March 16, 2015 23:47
recursive dot_clean
If you need a recurisve dot clean and your folders have spaces in them:
find . -type d | sed 's/^/"/g' | sed 's/$/"/g' | xargs dot_clean -m
curl localhost:7071/sources -d '{"type":"value"}'
curl -X PUT localhost:7071/sources/1/value -d '"Hello world"'
curl localhost:7071/blocks -d '{"type":"pusher"}'
curl localhost:7071/blocks -d '{"type":"log"}'
curl localhost:7071/blocks -d '{"type":"valueGet"}'
curl localhost:7071/links -d '{"source":1}'
curl localhost:7071/links -d '{"source":1,"block":4}'
curl localhost:7071/connections -d '{"source":{"id":2,"route":0},"target":{"id":4,"route":0}}'
curl localhost:7071/connections -d '{"source":{"id":4,"route":0},"target":{"id":3,"route":0}}'
curl localhost:7071/blocks -d '{"type":"+"}' #1
curl localhost:7071/blocks -d '{"type":"first"}' #2
curl localhost:7071/blocks -d '{"type":"sink"}' #3
curl localhost:7071/blocks -d '{"type":"latch"}' #4
curl localhost:7071/blocks -d '{"type":"log"}' #5
curl localhost:7071/blocks -d '{"type":"identity"}' #6
curl -X PUT localhost:7071/blocks/2/routes/0 -d '{"type":"const","value":true}'
curl -X PUT localhost:7071/blocks/4/routes/0 -d '{"type":"const","value":0}'
curl -X PUT localhost:7071/blocks/1/routes/1 -d '{"type":"const","value":1}'
curl localhost:7071/blocks -d '{"type":"delay"}' #1
curl localhost:7071/blocks -d '{"type":"log"}' #2
curl localhost:7071/blocks -d '{"type":"kvGet"}' #3
curl localhost:7071/sources -d '{"type":"key-value"}' #4
curl localhost:7071/blocks -d '{"type":"isError"}' #5
curl localhost:7071/blocks -d '{"type":"latch"}' #6
curl localhost:7071/blocks -d '{"type":"kvSet"}' #7
curl localhost:7071/blocks -d '{"type":"gate"}' #8
curl localhost:7071/blocks -d '{"type":"+"}' #9
curl localhost:7071/blocks -d '{"type":"sink"}' #10
@sophia-ooo
sophia-ooo / main.go
Created September 11, 2014 03:07
simple data pipeline
package main
import (
"time"
"fmt"
)
type Task func(interface{}) interface{}
type Sink func(interface{})
@sophia-ooo
sophia-ooo / main.go
Last active August 29, 2015 14:05
global server state, individual client state, websocket, go
package main
import (
"encoding/json"
"fmt"
"github.com/gorilla/mux"
"github.com/gorilla/websocket"
"log"
"net/http"
"sync"