Skip to content

Instantly share code, notes, and snippets.

View azihsoyn's full-sized avatar

Naoya Yoshizawa azihsoyn

View GitHub Profile
@azihsoyn
azihsoyn / es.sh
Last active January 1, 2016 11:09 — forked from rajraj/es.sh
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.x86_64 -y
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@azihsoyn
azihsoyn / gist:8560029
Last active January 4, 2016 03:09
detail for https://twitter.com/azihsoyn/status/425837771870044160 同じような設定を書くのがめんどくさかったので。。 過去にも似たのがあった → https://twitter.com/cosadn/status/273498369240989696
<match elasticsearch.system1.subsystem1.server1.**>
index_name system1
type_name subsystem1
type elasticsearch
include_tag_key true
tag_key @log_name
host xxx.xxx.xxx.xxx
port 9200
logstash_format true
flush_interval 10s
package main
import (
"reflect"
"testing"
)
func BenchmarkSetIntMap(b *testing.B) {
m := make(map[int]bool)
for i := 0; i < b.N; i++ {
@azihsoyn
azihsoyn / design.go
Last active April 4, 2017 08:00 — forked from ikawaha/design.go
KeyがEnumで制限されているHashOf
package design // The convention consists of naming the design
// package "design"
import (
. "github.com/goadesign/goa/design" // Use . imports to enable the DSL
. "github.com/goadesign/goa/design/apidsl"
)
var _ = API("cellar", func() { // API defines the microservice endpoint and
Title("The virtual wine cellar") // other global properties. There should be one
Description("A simple goa service") // and exactly one API definition appearing in
@azihsoyn
azihsoyn / circle.yml
Created March 23, 2018 12:43
example circleci 2.0 with go 1.10
version: 2
jobs:
build:
working_directory: /go/src/github.com/your_company/your_app
docker:
- image: circleci/golang:1.10.0
environment:
- GOCACHE: "/tmp/go/cache"
- DEP_VERSION: 0.4.1
steps:
version: 2
jobs:
build:
working_directory: /go/src/github.com/your_company/your_app
docker:
- image: circleci/golang:1.10.0
environment:
- DEP_VERSION: 0.4.1
steps:
- run: git config --global url.ssh://[email protected]/your_company.insteadOf https://github.com/your_company
version: 2
jobs:
build:
working_directory: /go/src/github.com/your_company/your_app
docker:
- image: circleci/golang:1.10.0
environment:
- GOCACHE: "/tmp/go/cache"
steps:
@azihsoyn
azihsoyn / mapFunc.go
Created July 4, 2018 16:32
go collection map
package main
import (
"fmt"
"github.com/kr/pretty"
)
type IntList []int
@azihsoyn
azihsoyn / collection.go
Last active October 8, 2018 17:07
collection by contract
type List(type T) []T
func (l *List(T)) Filter(func(T) bool) *List(T)
func (l *List(T)) Map(func(T) T) *List(T)
func main(){
var l List{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
l.Filter(func(i int) bool {
func generate(numRows int) [][]int {
ret := make([][]int, numRows)
for i := 1; i <= numRows; i++ {
ret[i-1] = make([]int, i)
ret[i-1][0], ret[i-1][i-1] = 1, 1
for j := 2; j < i && j <= numRows-1; j++ {
ret[i-1][j-1] = ret[i-2][j-2] + ret[i-2][j-1]
}
}
return ret