Skip to content

Instantly share code, notes, and snippets.

View kuntao's full-sized avatar

kuntao kuntao

  • Tokyo
View GitHub Profile
@kuntao
kuntao / main.go
Last active September 23, 2018 06:25
`go test` したいがtestifyの中でやってるType Assertで落ちる。これは適当に書いたコードで `main.go` の実装は空です。
package main
import "fmt"
func main() {
fmt.Println("Nothing Implemented")
}
package main
import (
"fmt"
"regexp"
"io/ioutil"
"net/http"
"net/url"
"strings"
)
@kuntao
kuntao / cfn_ecs.yml
Last active April 29, 2017 08:09
CloudFormation template for ECS
AWSTemplateFormatVersion: 2010-09-09
Description: |-
ECS Cluster test
Parameters:
VpcName:
Type: String
Default: dns_support_only
ClusterName:
Type: String
Default: dns_support_only
@kuntao
kuntao / codebuild_role.json
Created April 5, 2017 11:25
CodeBuild IAM Role for building docker image and push to ECR
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Resource": [
"arn:aws:logs:ap-northeast-1:022683276012:log-group:/aws/codebuild/eb_docker",
"arn:aws:logs:ap-northeast-1:022683276012:log-group:/aws/codebuild/eb_docker:*"
],
"Action": [
@kuntao
kuntao / docker_util_commands.sh
Created April 2, 2017 07:48
docker util shell commands
# login to docker host os (Docker for Mac)
screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
# get host ip from guest os
ip route | awk 'NR==1 {print $3}'
@kuntao
kuntao / push_docker_image.sh
Created March 28, 2017 10:03
shell script for build Dockerfile and push the image to ECR
#!/bin/bash
REPOSITORY=[[[[[ecr_registrory_name]]]]]
IMAGE=$REPOSITORY:latest
AWS_REGION=[[[[[your_region]]]]]
# docker login
aws ecr get-login --region $AWS_REGION
# docker build
@kuntao
kuntao / file0.txt
Last active March 17, 2017 01:23
MacOS Sierraでgvmを使ってGo 1.8をセットアップ ref: http://qiita.com/kuntao/items/e75bae225ab5da029252
# 最初のbashは適宜zshと置き換えてください
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
source $HOME/.gvm/scripts/gvm
gvm install go1.4.3
gvm use go1.4.3
export GOROOT_BOOTSTRAP=$GOROOT # ここまではうまくいく
gvm install go1.8 # 死
@kuntao
kuntao / parse.rb
Last active December 22, 2015 04:46
uri = 'http://some_domain/path/to/page?param1=val1&params2=val2&param3=val3'
uri
.split('?')
.last
.split(/[\&=]/)
.each_with_index
.select { |_, i| i%2 == 1 }
.map { |arr| arr[0] }
# メソッドチェーンだからここにendがない