Skip to content

Instantly share code, notes, and snippets.

@yoppi
yoppi / caching_bundle_install.md
Last active Dec 16, 2021
GitHub Actions上でのbundle installのキャッシュ
View caching_bundle_install.md

モチベーション

毎回bundle installするのはコストがかかるため、Gemfileに変更がない場合はキャッシュしたい。

参考 https://blog.freks.jp/github-action-cache/

+      - name: cache bundle directory
+        uses: actions/cache@v1
+ with:
@yoppi
yoppi / readfile.go
Created Aug 18, 2018
Fileを読み込むやつ
View readfile.go
$ ./file_read [~/d/src/go]
ReadFile:148545 elapsed:167.706µs
ReadLine:144946 elapsed:209.144µs
Scanner:144946 elapsed:553.246µs
@yoppi
yoppi / map.go
Created Apr 4, 2018
Goのmapは値渡しではない
View map.go
$ ./map
map[1:hoge]
&map[1:hoge]
map[1:hogehoge]
&map[1:hogehoge]
@yoppi
yoppi / regexp.go
Last active Oct 20, 2017
キャプチャするしない
View regexp.go
package regexp
import (
"regexp"
"testing"
)
func BenchmarkRegexp1(b *testing.B) {
re := regexp.MustCompile(`(iTunes)/(\d+)\.(\d+)`)
for i := 0; i < b.N; i++ {
@yoppi
yoppi / reading_dep.md
Last active Apr 5, 2017
depのコードリーディング
View reading_dep.md

depのコードを読んで面白いとか思った所

genericsないから案件

https://github.com/golang/dep/blob/4105d3a/context.go#L200-208 こういった任意の型のコンテナの探索はGenericsだ!と息巻く人もいると思うけど、stringしか扱わないならベタで書いたほうが僕は読みやすくていいと思う。

@yoppi
yoppi / git_fileters.md
Last active Mar 27, 2017
gitのfilterで指定できるatom一覧
View git_fileters.md
@yoppi
yoppi / uuid.sh
Created Mar 15, 2017
Gen uuid in command line
View uuid.sh
uuidgen | tr '[:upper:]' '[:lower:]' # Mac OS(darwin) generate default uppercase
@yoppi
yoppi / tcpdos.go
Last active May 12, 2017
DoS for TCP
View tcpdos.go
package main
import (
"bytes"
"flag"
"fmt"
"net"
"runtime"
"strconv"
"sync"
View each_vs_compact_map_uniq_bench.rb
require 'benchmark'
N = 5
TRY = 1_000_000
campaign = Struct.new("Campagin", :id)
campaings = []
N.times { |i| campaings << campaign.new(i+1) }
def each(ary)
@yoppi
yoppi / unicorn_vs_puma.md
Last active Feb 12, 2017
Unicorn vs Puma
View unicorn_vs_puma.md

Unicorn

 < ab -n 10000 -c 100 'http://127.0.0.1:8080/loadtest'
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 1000 requests