Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

NAKAMURA, Tomohiro tomoh1r

I may be slow to respond.
View GitHub Profile
tomoh1r / pwd.ps1
Created Oct 22, 2014
ホームディレクトリを ~ にするなど
View pwd.ps1
$_path = $(Get-Location).Path
if ($_path.IndexOf($ENV:HOME) -eq 0) {
$_path = Join-Path '~' ($PWD.ProviderPath.Remove(0, ($ENV:HOME).Length))
tomoh1r / spam.rst
Last active Aug 29, 2015
View spam.rst
[spam@ham ~]$ mysql -u egg
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3029885
Server version: 5.5.27-log MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
tomoh1r / README.rst
Last active Mar 5, 2021
gofmt のインデント、ハードタブが規定なのはここらあたりかな
View README.rst


2009年の changeset なので、今とオプションが異なる場合があるので注意。

(「This will make the code alignment insensitive to an editor's tabwidth.」の訳は自信ない。)

$ hg clone -u release
$ cd go/
tomoh1r / README.rst
Last active Aug 29, 2015
redmine から json でデータを取得
View README.rst

Redmine からデータを JSON で取得する。

issue_number, url, username, password は適宜

tomoh1r / hoge.rst
Last active Jan 4, 2016
View hoge.rst


hg log --rev "min(modifies('</target/file/path>') and <target_change_set>: and ! <target_change_set>)"


hg log --rev "max(modifies('</target/file/path>') and :$<target_change_set>~1)"
tomoh1r /
Last active Jan 1, 2016
docker の稼働中の container 全て落とす関数
docker_killall() {
# 処理が進んでいる container の id を取得
_get_ids() { docker ps | awk 'NR != 1 { print $1 }' ; }
# 処理中の conatainer の数を取得
_ps_count=$(_get_ids | wc -l)
# 処理中の container が有れば、全て落とす
if [[ $_ps_count != 0 ]] ; then
_get_ids | xargs docker kill
tomoh1r / find_in_set.sql
Last active Dec 30, 2015
View find_in_set.sql
mysql> STATUS
mysql Ver 14.14 Distrib 5.5.27, for Linux (x86_64) using readline 5.1
Connection id: 1
Current database: hogefugapiyo
Current user: spamspamspam@localhost
SSL: Not in use
Current pager: /usr/bin/less
Using outfile: ''
tomoh1r / README.rst
Last active Dec 20, 2015
Use multi Dropbox account on single Mac OS X
View README.rst

Use multi Dropbox account on single Mac OS X

How to use

$ touch ~/Library/LaunchAgents/local.dropbox.personal.plist