Skip to content

Instantly share code, notes, and snippets.

Hiroaki Nakamura hnakamur

Block or report user

Report or block hnakamur

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hnakamur
hnakamur / bench_test.go
Created Oct 3, 2019
Go benchmark StringBuilder with Fprintf
View bench_test.go
package main
import (
"fmt"
"strconv"
"strings"
"testing"
)
func dummy(s string) {}
@hnakamur
hnakamur / gist:3577388
Created Sep 1, 2012
cmake --system-information in directory without cmakefiles on OSX Mountain Lion
View gist:3577388
Avoid ctest truncation of output: CTEST_FULL_OUTPUT
========================================================
=== MAIN VARIABLES
========================================================
CMAKE_STATIC_LIBRARY_PREFIX == "lib"
CMAKE_STATIC_LIBRARY_SUFFIX == ".a"
CMAKE_SHARED_LIBRARY_PREFIX == "lib"
CMAKE_SHARED_LIBRARY_SUFFIX == ".dylib"
CMAKE_SHARED_MODULE_PREFIX == "lib"
CMAKE_SHARED_MODULE_SUFFIX == ".so"
@hnakamur
hnakamur / main.go
Created Sep 27, 2019
go exponential random distribution example
View main.go
package main
import (
crand "crypto/rand"
"encoding/binary"
"fmt"
"time"
"golang.org/x/exp/rand"
"gonum.org/v1/gonum/stat/distuv"
@hnakamur
hnakamur / main.go
Last active Aug 30, 2019
A go example to stop a worker goroutine when Ctrl-C is pressed (MIT License)
View main.go
package main
import (
"fmt"
"os"
"os/signal"
"time"
"golang.org/x/net/context"
)
@hnakamur
hnakamur / build_node9.sh
Created Jun 13, 2015
get and build node9
View build_node9.sh
#!/bin/sh
set -e
basedir=`pwd`
mkdir -p "$basedir/github.com/jvburnes"
git clone https://github.com/jvburnes/node9 "$basedir/github.com/jvburnes/node9"
mkdir -p "$basedir/github.com/stevedonovan"
git clone https://github.com/stevedonovan/Penlight "$basedir/github.com/stevedonovan/Penlight"
@hnakamur
hnakamur / go-carbon-carbonapi-grafana-setup-memo.txt
Last active Jul 4, 2019
go-carbon with built-in carbonserver enabled, carbonapi and grafana setup memo
View go-carbon-carbonapi-grafana-setup-memo.txt
# setup go
curl -sS https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz | tar zxf - -C /usr/local
export PATH=/usr/local/go/bin:$HOME/go/bin:$PATH
yum install -y make git
# setup go-carbon
go get -d github.com/lomik/go-carbon
cd $HOME/go/src/github.com/lomik/go-carbon
@hnakamur
hnakamur / index.html
Last active May 27, 2019
cytoscape network weathermap experiment
View index.html
<!DOCTYPE>
<html>
<head>
<title>network weathermap demo using cytoscape.js</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<script src="https://unpkg.com/cytoscape/dist/cytoscape.min.js"></script>
<script src="https://unpkg.com/cytoscape-automove@1.10.1/cytoscape-automove.js"></script>
<style>
#cy {
position: absolute;
@hnakamur
hnakamur / memo.md
Last active May 27, 2019
badger, goleveldb, boltdb benchmark
View memo.md
hnakamur@express:~/go/src/github.com/zchee/go-benchmarks/db$ go test -count=10 -run='^$' -bench=. -benchmem
goos: linux
goarch: amd64
pkg: github.com/zchee/go-benchmarks/db
BenchmarkGetBadger-2             5000000               399 ns/op          22.50 MB/s          40 B/op          2 allocs/op
BenchmarkGetBadger-2             5000000               390 ns/op          23.04 MB/s          40 B/op          2 allocs/op
BenchmarkGetBadger-2             5000000               390 ns/op          23.03 MB/s          40 B/op          2 allocs/op
BenchmarkGetBadger-2             5000000               391 ns/op          22.97 MB/s          40 B/op          2 allocs/op
BenchmarkGetBadger-2             5000000               391 ns/op          22.96 MB/s          40 B/op          2 allocs/op
@hnakamur
hnakamur / index.html
Created Jul 30, 2014
draggable quadratic bezier curve SVG example (MIT License)
View index.html
<!DOCTYPE html>
<html>
<head>
<title>draggable quadratic bezier curve</title>
<style>
#figure1 {
border: 1px solid black;
}
.draggable {
@hnakamur
hnakamur / ssh-key-login.ttl
Created Dec 11, 2012
TeraTermで鍵認証でログインするマクロ
View ssh-key-login.ttl
HOSTADDR = '${IPアドレス}'
USERNAME = '${ユーザ名}'
PROMPT = '${ユーザ名}@${ドメイン名}のパスフレーズを入力してください'
KEY_FILE = '${秘密鍵のフルパス}'
PASSWORD = ''
sprintf2 PASSFILE '%s.password.dat' KEY_FILE
getpassword PASSFILE PROMPT PASSWORD
sprintf2 COMMAND '%s /ssh /2 /auth=publickey /user=%s /passwd=%s /keyfile="%s"' HOSTADDR USERNAME PASSWORD KEY_FILE
You can’t perform that action at this time.