Skip to content

Instantly share code, notes, and snippets.

joonas.fi joonas-fi

View GitHub Profile
@joonas-fi
joonas-fi / main.go
Created Mar 14, 2019
Storm perf issue
View main.go
package main
import (
"github.com/asdine/storm"
"github.com/asdine/storm/codec/msgpack"
"os"
"encoding/json"
"io"
"fmt"
"bufio"
@joonas-fi
joonas-fi / README.md
Last active Feb 8, 2019
Go-koodauksen tipsejä
View README.md

kirjoitin muutamia ajatuksia ylös Go:n aloittamisesta:

hello worldin ajaminen

yksinkertaisin esimerkki, tallenna samaan hakemistoon nimellä hello.go

package main
View gist:bf80a2d3d4286e259183cf4fc3019864
$ time curl http://whoami.prod4.fn61.net/
... snipped
<title>whoami.prod4.fn61.net | 524: A timeout occurred</title>
... snipped

real    1m40.114s
user    0m0.008s
sys     0m0.004s
@joonas-fi
joonas-fi / logs-docker-oom-invalid-amount-of-swarm-replicas.md
Created Jan 6, 2017
logs-docker-oom-invalid-amount-of-swarm-replicas.md
View logs-docker-oom-invalid-amount-of-swarm-replicas.md
Jan 06 14:04:15 master dockerd[2325]: time="2017-01-06T14:04:13.208839706Z" level=info msg="libcontainerd: new containerd process, pid: 4140"
Jan 06 14:04:17 master dockerd[2325]: time="2017-01-06T14:04:13.273558318Z" level=error msg="libcontainerd: failed to receive event from containerd: rpc error: code = 13 desc = transport is closing"
Jan 06 14:04:24 master dockerd[2325]: time="2017-01-06T14:04:22.526231387Z" level=info msg="libcontainerd: new containerd process, pid: 4141"
Jan 06 14:04:34 master kernel: gmain invoked oom-killer: gfp_mask=0x24201ca, order=0, oom_score_adj=0
.. snip ..
Jan 06 14:04:34 master kernel: Out of memory: Kill process 4132 (php) score 935 or sacrifice child
Jan 06 14:04:34 master kernel: Killed process 4132 (php) total-vm:3392804kB, anon-rss:2912200kB, file-rss:0kB
Jan 06 14:04:34 master dockerd[2325]: time="2017-01-06T14:04:34.595231149Z" level=info msg="libcontainerd: new containerd process, pid: 4145"
Jan 06 14:04:34 master dockerd[2325]: time="2017-01-06T14:04:34.633952118
@joonas-fi
joonas-fi / find-unused-amd-imports.js
Created Nov 3, 2016
Finding unused AMD imports with amdextract without Grunt or Gulp etc.
View find-unused-amd-imports.js
#!/usr/bin/nodejs
// prerequisites: $ npm install -g amdextract@2.1.14
// Run this:
// $ export NODE_PATH=/usr/local/lib/node_modules # stupid nodejs
// $ find src/ -name '*.js' -not -path '*/vendor/*' -not -path '*/build/*' | bin/find-unused-amd-imports.js
var fs = require('fs');
var amdextract = require('amdextract');
View Monitor router aggregate bandwith usage via SNMP
/* Monitors aggregate bandwith directly from your router via SNMP
Public Domain.
Author: http://joonas.fi/
2014-03-09
Output:
You can’t perform that action at this time.