Skip to content

Instantly share code, notes, and snippets.

View umegaya's full-sized avatar

iyatomi takehiro umegaya

View GitHub Profile
@umegaya
umegaya / gist:67a9f92534b08fea4e4e18ac4d8312ab
Last active February 14, 2017 08:53
create self signed server crt/key
```
sudo openssl req -x509 -nodes -days 36500 -newkey rsa:2048 -keyout certout/server.key -out certout/server.crt
```
- highlight
- add set -e bofore subshell
- when you receive output of subshell, do not use local val=$(sub shell), but use local val; val=$(sub shell).
- test.sh
```
#!/bin/bash
set -e errexit
set -o pipefail
@umegaya
umegaya / ..build-protobuf-3.0.0.md
Created October 21, 2016 20:48 — forked from petewarden/..build-protobuf-3.0.0.md
Script used to build Google Protobuf 3.0.0 for use with Xcode 7 / iOS 9. Builds all supported architectures and produces a universal binary static library.

Google Protobuf 3.0.1 - Mac OS X and iOS Support

The script in this gist will help you buid the Google Protobuf library for use with Mac OS X and iOS. Other methods (such as homebrew or direct compilation) have issues that prevent their use. The libraries built by this script are universal and support all iOS device architectures including the simulator.

This gist was adapted from the original at https://gist.github.com/BennettSmith/7150245, and updated to deal with Xcode 7 and iOS 9, and download protobuf version 3.0.0.

@umegaya
umegaya / gist:3f693c7c484e5b8dd2ec56a34d73efd7
Created August 30, 2016 02:59
odb/protobuf docker example
define call_protoc
docker run --rm -v `pwd`:/mgo umegaya/protobuf bash -c "cd /mgo && protoc $1"
endef
define call_odb
docker run --rm -v `pwd`:/mgo umegaya/odb bash -c "cd /mgo && odb -I/usr/include/odb -d $1 -o $(MODEL_OUT_PATH) --generate-query --generate-schema $2"
endef
cproto:
$(call call_protoc,--cpp_out=$(OUT_PATH) $(PROTO_FILE))
@umegaya
umegaya / gist:ca9403de0bf44a60cf3d3e9ec041b26a
Created July 5, 2016 04:21
github issue comment crawler
package main
import (
"os"
"log"
"encoding/json"
"golang.org/x/oauth2"
"github.com/google/go-github/github"
)
@umegaya
umegaya / gist:1cfe1304b1fe1b34babf27fec52c809b
Created June 8, 2016 18:02
自分の作業用のブランチをmasterに追随させるスクリプト
#!/bin/bash
dst=$1
src=$2
if [ -z "$dst" ]; then
echo "usage: ./follow_branch.sh dst src(or master when omitted)"
exit 1
fi
if [ -z "$src" ]; then
src=master
fi
@umegaya
umegaya / loadtest.md
Last active April 1, 2016 08:31
一子相伝の負荷テスト覚書

テスト計画の策定

  • 負荷テスト = プロダクション運用時に想定される負荷と近い負荷をかけることで

    • 実運用時にもシステムが安定稼動するかを保証する
    • 高負荷時にしか発生しないバグや異常な挙動を検出する
  • プロダクション運用時に想定される負荷を見積もるには

    • アクセス規模の見積もり
      • 瞬間的なピークと通常想定されるピーク、それぞれの負荷を見積もる
  • ピーク時の負荷 = ユーザー数 x アクティブ率のプレイヤーが同時にゲームのメインセッションをプレイする想定

@umegaya
umegaya / gist:3fa1b3b8d86735474d8b
Created December 18, 2015 09:49
update certs with letsencrypt docker
docker run -it --rm --name letsencrypt -v `pwd`:/etc/letsencrypt -v /path/to/your/document/root:/www quay.io/letsencrypt/letsencrypt:latest certonly --webroot --webroot-path /www -d your.server.com
@umegaya
umegaya / file0.txt
Created April 4, 2015 21:29
docker-machine --driver virtualbox "No IP address found" でマシンを作れないとき ref: http://qiita.com/umegaya/items/17f868ef462fe76727dc
INFO[0000] Creating SSH key...
INFO[0000] Creating VirtualBox VM...
INFO[0011] Starting VirtualBox VM...
INFO[0012] Waiting for VM to start...
ERRO[0065] Error creating machine: No IP address found 4: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:26:c2:13 brd ff:ff:ff:ff:ff:ff
inet6 fe80::a00:27ff:fe26:c213/64 scope link
valid_lft forever preferred_lft forever
WARN[0065] You will want to check the provider to make sure the machine and associated resources were properly removed.
@umegaya
umegaya / gist:13a38ae871009901c5d7
Last active August 29, 2015 14:17
cockroach source code reading

========== cockroachの分散トランザクション

  • server(server.go) : リクエストを受け取り、rangeから探した処理先に送信する。
  • node(node.go) : serverが受け取ったリクエストをraft的に複数ノードにレプリケートする。
  • たぶん、server => node という流れで処理されるのだろう。

処理の階層構造

  • server