Skip to content

Instantly share code, notes, and snippets.

View mogproject's full-sized avatar

Yosuke Mizutani mogproject

View GitHub Profile
@mogproject
mogproject / AnsibleCheatSheet.md
Last active August 29, 2015 14:08
Ansible Cheat Sheet

Ansible Cheat Sheet

  • コマンド結果によって処理の要否を判断する
    • register を使ってコマンド実行結果を変数に格納。
    • ignore_errors は必須。changed_when, failed_when は表示を見やすくするために。
- name: check if YOUR_MODULE is installed
 command: /usr/bin/test -e PATH_TO_THE_FILE
@mogproject
mogproject / RedshiftCheatSheet.md
Last active August 29, 2015 14:07
Redshift Cheat Sheet

Redshift Cheat Sheet

接続

  • psql で接続
psql -h <エンドポイントURL> -U <接続ユーザ> -d <データベース名> -p <ポート番号>
@mogproject
mogproject / GitCheatSheet.md
Last active August 29, 2015 14:04
Git Cheat Sheet

Git Cheat Sheet

  • リモートブランチをローカルに取得してチェックアウト
git checkout -t -b branch_name origin/branch_name
  • 直前コミットの author を修正
@mogproject
mogproject / ShellScriptCheatSheet.md
Last active May 5, 2024 06:44
Shell Script Cheat Sheet

Shell Script Cheat Sheet

原則、Bourne Shell 互換のものを書く

  • 実行中のスクリプトがあるディレクトリをフルパスで取得
SCRIPT_DIR=$( cd "$( dirname "$0" )" && pwd -P )
@mogproject
mogproject / MySQLCheatSheet.md
Last active August 29, 2015 14:02
MySQL Cheat Sheet

MySQL Cheat Sheet

確認

  • データベース一覧
show databases
$ ./docker_sbt_test.py local/sbt-test --dir /workspace/docker-sbt-test/example --setup " \
rm -fr /workspace/docker-sbt-test && \
git clone --depth 1 https://github.com/mogproject/docker-sbt-test.git /workspace/docker-sbt-test \
"
2014-01-11 07:24:53,272 [INFO] Creating test image (local/sbt-test:test-1389425093.27) ...
Uploading context 2.048 kB
Step 1 : FROM local/sbt-test:latest
---> de04dd418dc0
Step 2 : RUN /bin/bash -c " rm -fr /workspace/docker-sbt-test && git clone --depth 1 https://github.com/mogproject/docker-sbt-test.git /workspace/docker-sbt-test "
---> Running in 8b9c2b674e0d
----system---- ---load-avg--- ----total-cpu-usage---- -dsk/total- -net/total- ------memory-usage----- ---paging-- ---system-- -most-expensive- ----most-expensive---- ----most-expensive---- --most-expensive-
date/time | 1m 5m 15m |usr sys idl wai hiq siq| read writ| recv send| used buff cach free| in out | int csw | cpu process | i/o process | block i/o process | memory process
11-01 07:24:47|0.74 0.79 0.37| 0 0 99 0 0 0| 19k 110k| 0 0 | 409M 221M 1306M 1894M| 50B 125B| 141 166 |docker 0.1|docker 103k 93k|docker 100k 51k|docker 58.0M
11-01 07:24:48|0.74 0.79 0.37| 0 2 98 0 0 0| 0 124k| 60B 534B| 410M 221M 1306M 1893M| 0 0 | 135 68 | |sshd: vagra1773B 480B| |docker 58.0M
11-01 07:24:49|0.74 0.79 0.37| 1 1 99 0 0 0| 0 0 | 60B 198B| 410M 221M 1306M 1893M| 0 0 | 49 30 | |sshd: vagra 591B 144B|loop1 0 4096B|docker
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
print_histo.py
Visualize histogram as text.
"""
import sys
import numpy
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""""
Bipartite graph matching algorithm
"""
import collections
class Graph(object):
for(i<-1 to'd')println(Seq("Fizz"*(1-i%3)+"Buzz"*(1-i%5),""+i)max)