Skip to content

Instantly share code, notes, and snippets.

View mogproject's full-sized avatar

Yosuke Mizutani mogproject

View GitHub Profile
@mogproject
mogproject / PythonUnitTestCheatSheet.md
Created July 24, 2015 11:17
Python unittest Cheat Sheet

Python unittest Cheat Sheet

Skeleton

@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]:
@mogproject
mogproject / SSHTroubleshooting.md
Last active January 23, 2016 05:09
Troubleshooting Guide for SSH Connection Error

ssh が繋がらないときのトラブルシューティングまとめ

ssh -vvvv 出力例

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/xxx/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 53: Applying options for *
@mogproject
mogproject / CubaseCheatSheet.md
Last active June 19, 2017 16:31
Cubase Cheat Sheet

Cubase Pro 8

調・拍子の設定

  • Command-B: Browse Project
  • Tempo Track
  • Signature Track

メトロノームを鳴らす

/** Immutable 0-indexed Binary Index Tree (BIT) */
case class BinaryIndexedTree[A](size: Int, cumulatives: Vector[A])(implicit num: Numeric[A]) {
require(cumulatives.size == size + 1)
/** Return the sum of the values indexed from 0 to index (time: O(log(size))) */
def sum(until: Int): A = {
@annotation.tailrec
def f(n: Int, sofar: A): A =
if (n == 0)
sofar
#!/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 / MacCheatSheet.md
Created February 15, 2015 15:03
Mac Cheat Sheet

Mac Cheat Sheet

  • ランダムなパスワードの生成
$ brew install pwgen
$ pwgen -s 32 1
5IhJe8rhdG9fJCsq1tVBQWUJjIjCCMWe
### 32文字のセキュアな文字列を一個生成/シンボルを含めたい場合は -y オプション

Log File Cheat Sheet

  • Homebrew: ~/Library/Logs/Homebrew/
@mogproject
mogproject / AWKCheatSheet.md
Last active August 29, 2015 14:08
AWK Cheat Sheet

AWK Cheat Sheet

  • shebang
#!/usr/bin/env awk -f
  • 先頭の n 個の要素を除外
@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