-
-
Save MostAwesomeDude/af932a4c56a5661934312c4b68f0531d to your computer and use it in GitHub Desktop.
Derive stats from history-v2 feeds on https://channels.nix.gsc.io/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "lib/codec/utf8" =~ [=> UTF8] | |
import "lib/streams" =~ [=> collectBytes] | |
import "lib/welford" =~ [=> makeWelford] | |
exports (main) | |
def main(_argv, => stdio) as DeepFrozen: | |
def bs := collectBytes(stdio<-stdin()) | |
return when (bs) -> | |
def w := makeWelford() | |
for line in (bs.split(b`$\n`)): | |
if (line =~ b`@_commit @start @stop`): | |
def startTime := _makeInt.fromBytes(start) | |
def stopTime := _makeInt.fromBytes(stop) | |
w((stopTime - startTime).asDouble()) | |
def stdout := stdio<-stdout() | |
def summary := `Mean: ${w.mean()} Std. Dev.: ${w.standardDeviation()} Skew: ${w.skew()} Kurtosis: ${w.kurtosis()}` | |
when (stdout<-(UTF8.encode(summary, null)), stdout<-complete()) -> { 0 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment