Skip to content

Instantly share code, notes, and snippets.

$ go test -race
2016/10/05 14:58:28 S3 Bucket Cache Set - {"CacheItem":{"Timestamp":"2016-10-05T14:58:28.563142289Z","TTL":2000000000},"Name":"bucket_test_add","Location":"eu-west-1"}
2016/10/05 14:58:28 S3 Bucket Cache Hit - {"CacheItem":{"Timestamp":"2016-10-05T14:58:28.563142289Z","TTL":2000000000},"Name":"bucket_test_add","Location":"eu-west-1"}
2016/10/05 14:58:28 S3 Bucket Cache Set - {"CacheItem":{"Timestamp":"2016-10-05T14:58:28.56391918Z","TTL":2000000000},"Name":"bucket_test_expire","Location":"eu-west-1"}
2016/10/05 14:58:31 S3 Bucket Cache Miss - {"Name":"bucket_test_expire"}
2016/10/05 14:58:31 S3 Object Cache Miss - {"Key":"object_test_add"}
==================
--- FAIL: TestCacheObjectGet (0.00s)
WARNING: DATA RACE
Write at 0x00c4200814d0 by goroutine 10:
2016/09/13 20:36:22 [INFO] Terraform version: 0.7.3 0dd7c657d6d60d2e7392b66ae6f74fb84582cab9
2016/09/13 20:36:22 [INFO] CLI args: []string{"/home/kkojima/bin/terraform", "plan"}
2016/09/13 20:36:22 [DEBUG] Detected home directory from env var: /home/kkojima
2016/09/13 20:36:22 [DEBUG] Detected home directory from env var: /home/kkojima
2016/09/13 20:36:22 [DEBUG] Attempting to open CLI config file: /home/kkojima/.terraformrc
2016/09/13 20:36:22 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2016/09/13 20:36:22 [DEBUG] Detected home directory from env var: /home/kkojima
2016/09/13 20:36:22 [TRACE] Preserving existing state lineage "776f5749-5ca1-407c-bfd9-1ba658fca5e8"
2016/09/13 20:36:22 [TRACE] Preserving existing state lineage "776f5749-5ca1-407c-bfd9-1ba658fca5e8"
2016/09/13 20:36:22 [TRACE] Graph after step *terraform.ConfigTransformer:
@kjmkznr
kjmkznr / blue.tf
Last active September 4, 2016 09:13
Blue Green Deployments with Terraform
# Blue
variable "blue" {
default = "0"
}
resource "aws_autoscaling_group" "blue" {
count = "${signum(var.blue)}"
name = "blue"
max_size = 2
min_size = 1
@kjmkznr
kjmkznr / benchmark.md
Last active July 18, 2016 17:58
using lwan from golang

benchmark result

EC2 m3.medium / Gentoo Linux

go version go1.3.3 linux/amd64

$ ./wrk http://localhost:8081/hello
Running 10s test @ http://localhost:8081/hello
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
provider "aws" {
alias = "tokyo"
region = "ap-northeast-1"
}
provider "aws" {
alias = "seoul"
region = "ap-northeast-2"
}
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
)
@kjmkznr
kjmkznr / gist:efdd098a9f0f5aafa0cf04bc8cadb7e9
Last active June 29, 2016 09:34
mediainfo static build
emerge -DN world
echo net-misc/openssh -static >> /etc/portage/package.use/openssh
echo sys-apps/coreutils -static >> /etc/portage/package.use/coreutils
echo net-misc/wget -static >> /etc/portage/package.use/wget
emerge openssl openssh
emerge --buildpkg=y --usepkg=y --onlydeps media-video/mediainfo
CURL_SSL="gnutls" emerge curl
x86_64-pc-linux-gnu-g++ -O2 -pipe -fPIC -DUNICODE -DUNICODE -DSIZE_T_IS_LONG -Wl,-O1 -o mediainfo CLI_Main.o CommandLine_Parser.o Help.o Core.o -Wl,-Bstatic -lmediainfo -lz -lzen -lpthread -lstdc++ -ltinyxml2 -lcurl -lgnutls -ltasn1 -lz -lnettle -lhogweed -lgmp -static-libgcc
$ docker-machine create --driver virtualbox local
#!/bin/sh
CC="gcc"
OPT="-march=native"
NATIVE=$(echo | ${CC} -E -v ${OPT} - 2>&1 | grep cc1)
NOARCH=$(echo | ${CC} -E -v - 2>&1 | grep cc1)
for native in ${NATIVE} ; do
FOUND=0
for noarch in ${NOARCH} ; do
@kjmkznr
kjmkznr / file0.txt
Created April 13, 2016 13:11
GentooでRPMパッケージを作成する ref: http://qiita.com/kjmkznr@github/items/19012244f0bc31a3e170
$ sudo emerge --pkg-format=rpm --buildpkgonly <category>/<package>