Skip to content

Instantly share code, notes, and snippets.

View otiai10's full-sized avatar
👋

Hiromu OCHIAI otiai10

👋
View GitHub Profile
@shoya140
shoya140 / go.snip
Last active August 29, 2015 13:59
snippet package main
abbr minimal template with importing fmt
options head
package main
import (
"fmt"
)
func main() {
@mattlewissf
mattlewissf / add-p.md
Last active April 11, 2025 22:02
Lightning Talk: Git add -p

git add -p is your friend

git add -p is basically "git add partial (or patch)"

Patch mode allows you to stage parts of a changed file, instead of the entire file. This allows you to make concise, well-crafted commits that make for an easier to read history. This feature can improve the quality of the commits. It also makes it easy to remove parts of the changes in a file that were only there for debugging purposes - prior to the commit without having to go back to the editor.

It allows you to see the changes (delta) to the code that you are trying to add, and lets you add them (or not) separately from each other using an interactive prompt. Here's how to use it:

from the command line, either use

  • git add -p
@lestrrat
lestrrat / mecab.go
Created March 10, 2014 05:00
俺俺 golang mecabバインディング(mecabで日本語をトークナイズするためのミニマルなヤツ)
package tokenizer
/*
#cgo CFLAGS: XXX CHANGE ME XXX
#cfo LDFALGS: XXX CHANGE ME XXX
#include <mecab.h>
struct mecab_t {}
*/
import "C"
import "errors"
@taea
taea / rm_pid.md
Last active January 12, 2023 14:22
postgres をちゃんと終了しないと.pidファイルが残っちゃって、Rails が起動しないもんだい

Rails 起動しようとするとこんなエラーでる

PG::ConnectionBad at /
could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

http://www.youtube.com/watch?v=Jo0gY4EjW2o

最初、ハートのAとハートのKが2枚重なって、表向けられて、 そのハートのKにはあらかじめサインしておきます。 で、上から3枚目のカードもハートのK。

[表] A
[表] K サイン済み
[裏] K
@otiai10
otiai10 / zshrc.sh
Last active January 8, 2019 01:08
zshのプロンプトにブランチ名とかステータスとか出すアレ
# ----- PROMPT -----
## PROMPT
PROMPT=$'[%*] → '
## RPROMPT
RPROMPT=$'`branch-status-check` %~' # %~はpwd
setopt prompt_subst #表示毎にPROMPTで設定されている文字列を評価する
# {{{ methods for RPROMPT
# fg[color]表記と$reset_colorを使いたい
# @see https://wiki.archlinux.org/index.php/zsh
@sergiotapia
sergiotapia / images_dimensions.go
Last active November 16, 2024 05:40
Golang - Getting the dimensions of an image. jpg, jpeg, png
package main
import (
"fmt"
"image"
"os"
_ "image/jpeg"
_ "image/png"
)
@shunirr
shunirr / yuiyuinikki_kaomoji.csv
Created November 21, 2013 16:17
ゆいゆい日記内に出てくる顔文字の一覧です。左の数値は出現回数になっています。
1728 (*-v・)
373 (∩^ω^∩)
329 (○>ω<○)
322 (´ω`)
274 (-∀-)
240 (´`)
145 (´Д`)
145 (^ω^)
130 (*-∀-)
101 (´-ω-`)
@dmitshur
dmitshur / gist:6927554
Last active December 29, 2024 12:06
[Legacy GOPATH mode] How to `go get` private repos using SSH key auth instead of password auth.