ここでは、休日のコーディングの際に作成したツール等の覚書きを記述します。
[全般]
特定のプログラミング言語を習得しようとするとき、その言語の下記をおさえればなんとかなる。 (※)
・プログラミング言語のバージョン管理システム。(e.g., Python の pyenv)
・ロギングの仕組み。 (デバッグに使う。) (e.g. Python の logging)
・単体テストツール。 (e.g., Python の unitttest)
・ビルドシステム。(e.g., Java の Ant)
・ファイル入出力の関数。
※ 以下のような問いを考えるのもよい。
観念的な問い: 上記の項目をおさえてもなんとかならなそうなプログラミング言語習得に必要なものは何か。
[R]
ARMA モデルの時系列を生成 (e.g., n: 100, 自己回帰係数 (ar): 0.5, 移動平均係数 (ma): 0.5)
ワンライナー:
N=100;AR=0.5;MA=0.5;Rscript−e"options(max.print=999999);arima.sim(n=N=100;AR=0.5;MA=0.5;Rscript−e"options(max.print=999999);arima.sim(n={N},list(ar=AR,ma=AR,ma={MA}))" | sed -n 5,\p | sed -e 's/ /\n/g' | grep "[0-9]" | grep -v '\[' > arma_p | sed -e 's/ /\n/g' | grep "[0-9]" | grep -v '\[' > arma_{N}_{AR}_{AR}_{MA}
R のバッチ処理コマンド Rscript を用いて、 ARMA モデルの時系列を生成します。
処理の流れ:
入力: N, AR, MA
出力: ARMAモデルの時系列を保存したファイル
Step 1. 関数 arima.sim で時系列を生成。
Step 2. sed -n 5,\$p で必要な行を抽出。
Step 3. sed -e 's/ /\n/g' で空白を改行に置換。
Step 4. grep "[0-9]" で数値がある行のみ抽出。
Step 5. grep -v '\[' で行数を示す表示の行を除外。
source /home/tadachikaoki/antigen.zsh
# history
# refference: https://masutaka.net/chalow/2014-05-18-2.html
HISTFILE=$HOME/.zhistory
HISTSIZE=1000000
SAVEHIST=1000000
setopt extended_history
alias hall="history -E -i 1"
autoload history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey "^p" history-beginning-search-backward-end
bindkey "^n" history-beginning-search-forward-end
# Load the oh-my-zsh's library.
antigen use oh-my-zsh
# Bundles from the default repo (robbyrussell's oh-my-zsh).
antigen bundle git
antigen bundle heroku
antigen bundle pip
antigen bundle lein
antigen bundle command-not-found
# Syntax highlighting bundle.
antigen bundle zsh-users/zsh-syntax-highlighting
# Load the theme.
antigen theme robbyrussell
# auto completion
antigen bundle zsh-users/zsh-completion
# Tell Antigen that you're done.
antigen apply