Skip to content

Instantly share code, notes, and snippets.

View mogproject's full-sized avatar

Yosuke Mizutani mogproject

View GitHub Profile
@mogproject
mogproject / MySQLCheatSheet.md
Last active August 29, 2015 14:02
MySQL Cheat Sheet

MySQL Cheat Sheet

確認

  • データベース一覧
show databases
@mogproject
mogproject / ShellScriptCheatSheet.md
Last active August 29, 2015 14:03
Shell Script Cheat Sheet

Shell Script Cheat Sheet

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

  • 実行中のスクリプトがあるディレクトリをフルパスで取得
SCRIPT_DIR=$( cd "$( dirname "$0" )" && pwd -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 / RedshiftCheatSheet.md
Last active August 29, 2015 14:07
Redshift Cheat Sheet

Redshift Cheat Sheet

接続

  • psql で接続
psql -h <エンドポイントURL> -U <接続ユーザ> -d <データベース名> -p <ポート番号>
@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 / AWKCheatSheet.md
Last active August 29, 2015 14:08
AWK Cheat Sheet

AWK Cheat Sheet

  • shebang
#!/usr/bin/env awk -f
  • 先頭の n 個の要素を除外

Log File Cheat Sheet

  • Homebrew: ~/Library/Logs/Homebrew/
@mogproject
mogproject / MacCheatSheet.md
Created February 15, 2015 15:03
Mac Cheat Sheet

Mac Cheat Sheet

  • ランダムなパスワードの生成
$ brew install pwgen
$ pwgen -s 32 1
5IhJe8rhdG9fJCsq1tVBQWUJjIjCCMWe
### 32文字のセキュアな文字列を一個生成/シンボルを含めたい場合は -y オプション
#!/bin/bash
GIT=/usr/local/bin/git
SCRIPT_DIR=$( cd "$( dirname "$0" )" && pwd -P )
if [ "$1" = "clone" ]; then
origin_url="$2"
else
# check if current directory is under git repository
origin_url=$("$GIT" config --get remote.origin.url) || {
@mogproject
mogproject / AWSCLICheatSheet.md
Last active August 29, 2015 14:23
AWS CLI Cheat Sheat

対話的な config 設定

$ aws configure
AWS Access Key ID [None]: XXXXXX
AWS Secret Access Key [None]: XXXXXX
Default region name [None]: ap-northeast-1
Default output format [None]: