Skip to content

Instantly share code, notes, and snippets.

View mccanne's full-sized avatar

Steve McCanne mccanne

View GitHub Profile
@mccanne
mccanne / main.go
Last active July 17, 2022 23:19
Zed/JSON Marshaling Perf Test
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"math/rand"
"time"
% zq -Z "sample" zed-sample-data/zng/*.gz
{
sample: {
_path: "conn",
ts: 2018-03-24T17:15:21.255387Z,
uid: "C8Tful1TvM3Zf5x8fl" (bstring),
id: {
orig_h: 10.164.94.120,
orig_p: 39681 (port=(uint16)),
@mccanne
mccanne / .block
Last active May 26, 2020 02:15
demo of zar/zq graph query
license: gpl-3.0
license: gpl-3.0
@mccanne
mccanne / rando.go
Created April 22, 2020 17:39
generate some random zng for testing
package main
import (
"fmt"
"math/rand"
"time"
"github.com/tjarratt/babble"
)
@mccanne
mccanne / main.juttle
Created February 15, 2015 03:18
chord anti-pattern
const scale = 0.9;
emitter -hz 20 -limit 1000 | (
put first=Math.sin(scale*2*Math.PI*Date.unixms(time)/1000.) |
put third=Math.sin(1.25*scale*2*Math.PI*Date.unixms(time)/1000.) |
put fifth=Math.sin(1.5*scale*2*Math.PI*Date.unixms(time)/1000.) |
( split 'first','third','fifth' | @timechart ;
put value=first+third+fifth | keep time,value |
@timechart -title 'major chord' )
;
put first=Math.sin(scale*2*Math.PI*Date.unixms(time)/1000.) |
@mccanne
mccanne / README.md
Last active August 29, 2015 14:15
harmonics

A toy example of Juttle that illustrates how far one can push on the modularity of subgraphs...

@mccanne
mccanne / main.juttle
Last active August 29, 2015 14:13
Juttle "hello, world"
emitter -limit 5 | put message='Hello, world' | @table
@mccanne
mccanne / README.md
Last active August 29, 2015 14:10
Multiple dice games

A simple example where we run multiple dice games, illustrating how modularity and subgraphs are helpful

@mccanne
mccanne / README.md
Last active August 29, 2015 14:10
Dice game histogram.

Roll dice and compute a histogram displayed as a barchart.