Skip to content

Instantly share code, notes, and snippets.

View joonas-fi's full-sized avatar
💭
🇺🇦

joonas.fi joonas-fi

💭
🇺🇦
View GitHub Profile
@joonas-fi
joonas-fi / md4.go
Last active January 29, 2023 15:59
A stab at faster MD4 for Go
package main
import (
"encoding/binary"
"hash"
)
// The size of an MD4 checksum in bytes.
const Size = 16
exports.handler = async (ctx, console, browser) => {
const page = await browser.newPage();
// has breakpoints for mobile resolution that makes map display different,
// so better increase resolution
await page.setViewport({
width: 1280,
height: 1024,
})
@joonas-fi
joonas-fi / main.go
Created March 14, 2019 13:37
Storm perf issue
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 February 8, 2019 12:39
Go-koodauksen tipsejä

kirjoitin muutamia ajatuksia ylös Go:n aloittamisesta:

hello worldin ajaminen

yksinkertaisin esimerkki, tallenna samaan hakemistoon nimellä hello.go

package main
$ 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 January 6, 2017 14:25
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 November 3, 2016 13:30
Finding unused AMD imports with amdextract without Grunt or Gulp etc.
#!/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');
/* Monitors aggregate bandwith directly from your router via SNMP
Public Domain.
Author: http://joonas.fi/
2014-03-09
Output: