Skip to content

Instantly share code, notes, and snippets.

View smagch's full-sized avatar
🗾
Hokkaido

Shimaguchi Tomoya smagch

🗾
Hokkaido
View GitHub Profile
@smagch
smagch / lists.md
Last active December 27, 2015 11:39
useful command for Git

Useful Git Commands

I'm going to hold a Git study session on November 14th. This gist is just a personal memo.

Commands

  • git diff --cached use this everytime before commiting in order to avoid tiny careless mistakes.
  • git diff --name-only | xargs grep 'word-you-want-to-search' grep "word-you-want-to-search" among changed files.
  • git log -10 --graph | less show quick history.
  • git stash and (git stash pop or git stash apply) you should use them to switch branches.
@smagch
smagch / file0.txt
Created January 2, 2014 09:37
Pro Gitを使ったGitハンズオン勉強会のTips ref: http://qiita.com/smagch@github/items/4e9cb00520ba78767e22
$ git log --oneline --graph
* 2d05679 Merge branch 'master' of https://github.com/AOSC/git-exercises
|\
| * 6f9d8a3 Merge branch 'master' of https://github.com/AOSC/git-exercises
| |\
| | * 21f7ecc add masaru99 #1
| | |\
| | | * 039e884 add asahi #1
| | * | 8a49030 add masaru99
| | |/
@smagch
smagch / README.md
Created January 27, 2014 05:07
Open Data Day 2014の原稿
@smagch
smagch / README.md
Last active August 29, 2015 13:56
Golang: simple string processing vs regexp

string processing vs Regexp benchmark

BenchmarkFirstWithStringMatch	20000000	       127 ns/op
BenchmarkFirstWithRegexpMatch	 1000000	      1067 ns/op
@smagch
smagch / README.md
Last active August 29, 2015 13:56
Golang: simple string processing vs char map vs regexp

simple string processing vs char map vs regexp

BenchmarkRune	20000000	       152 ns/op
BenchmarkMap	 5000000	       346 ns/op
BenchmarkRegexp	 1000000	      1034 ns/op
@smagch
smagch / README.md
Last active March 21, 2018 21:43
golang: string equals length benchmark

golang: string equals length benchmark

BenchmarkOneLengthByte	2000000000	         0.40 ns/op
BenchmarkTenLengthStringByte	50000000	        35.0 ns/op
BenchmarkSixtyLengthByte	20000000	       126 ns/op
BenchmarkOneLengthString	200000000	         9.30 ns/op
BenchmarkTenLengthString	200000000	         9.26 ns/op
BenchmarkSixtyLengthString	200000000	         9.38 ns/op
BenchmarkOneLengthRegexp	10000000 294 ns/op
@smagch
smagch / README.md
Last active February 18, 2019 08:17
Golang: map vs struct loopkup benchmark
BenchmarkStruct1	50000000	        41.1 ns/op
BenchmarkMap1	50000000	        43.5 ns/op
BenchmarkStruct2	50000000	        42.8 ns/op
BenchmarkMap2	50000000	        44.4 ns/op
BenchmarkStruct3	50000000	        45.3 ns/op
BenchmarkMap3	50000000	        37.0 ns/op
BenchmarkStruct4	50000000	        42.2 ns/op
BenchmarkMap4	50000000	        37.3 ns/op
@smagch
smagch / README.md
Last active August 29, 2015 13:57
Golang: Suffix match benchmark, regexp vs rune match
BenchmarkSuffixMatchByRuneLength10	10000000	       226 ns/op
BenchmarkSuffixMatchByRuneLength30	 5000000	       630 ns/op
BenchmarkSuffixMatchByRegexpLength10	 1000000	      2033 ns/op
BenchmarkSuffixMatchByRegexpLength30	  500000	      4863 ns/op

ターミナルを開いて以下をコマンドする。

$ curl -sSL https://raw.github.com/isaacs/nave/master/nave.sh | bash -s usemain 0.10 && npm install -g autoprefixer

コマンドの使い方は以下を参照。

@smagch
smagch / date_sha224.go
Last active August 29, 2015 13:59
(date + sha224) byte array
package main
// http://play.golang.org/p/F3XbXbmAgr
import (
"fmt"
"encoding/binary"
"crypto/sha256"
"io"
"time"
)