Skip to content

Instantly share code, notes, and snippets.

View hnakamur's full-sized avatar

Hiroaki Nakamura hnakamur

View GitHub Profile
@hnakamur
hnakamur / bm_test.go
Last active August 19, 2021 12:56 — forked from mipearson/bm_test.go
Add an increment of a global variable after each op to ensure the Go compiler isn't being clever about optimisation.
package bm
import (
"testing"
)
var mb = map[string]bool{
"alpha": true,
"beta": true,
"gamma": true,
package main
import (
"flag"
"fmt"
"os"
)
var usage = `Usage argtest [Globals] <Command> [Options]
Commands:
@hnakamur
hnakamur / diag.md
Created October 18, 2015 07:28 — forked from hashrock/diag.md
作図系ツール・ライブラリまとめ

シーケンス図とかフローチャートをしごとで描画することになった場合、 テキストから生成できたら楽なので、それ系のツールまとめ

GraphViz

http://www.graphviz.org/

  • C製
  • Doxygen, Moinmoinなどと連携可能
  • ブロック図、クラス図、ネットワーク図など
@hnakamur
hnakamur / hello.go
Created September 28, 2015 12:44 — forked from hatajoe/hello.go
`runtime/cgo: could not obtain pthread_keys' on darwin/amd64
// file: plugins/hello/hello.go
// $ go build -o libhello.so -buildmode=c-shared hello.go
package main
import "C"
import (
"log"
)
#!/bin/sh
set -e
mkdir -p target
mkdir -p deps
git clone https://github.com/rust-lang/regex deps/regex
git clone https://github.com/rust-lang/semver deps/semver
git clone https://github.com/dguo/strsim-rs deps/strsim-rs
package main
import (
"fmt"
"github.com/typester/go-pit"
"io/ioutil"
"log"
"net"
"net/http"
)
@hnakamur
hnakamur / env_copy_test.bench
Created September 17, 2012 02:18 — forked from kristate/env_copy_test.bench
test on how to copy worker env for spawning
hnakamur@ubuntu:~/execve_env_copy$ gcc -O3 env_copy_test.c
hnakamur@ubuntu:~/execve_env_copy$ rm env_copy_test
hnakamur@ubuntu:~/execve_env_copy$ ./a.out
type_a: 0.750000 seconds
type_b: 0.730000 seconds
type_c: 0.640000 seconds
type_d: 0.860000 seconds
type_e: 0.760000 seconds
hnakamur@ubuntu:~/execve_env_copy$ ./a.out
type_a: 0.750000 seconds