Notes
Symbols | Git & GitHub | Docker | Kubernetes (k8s) | k9s | Linux | Anaconda | Color for figure |
Symbols | Git & GitHub | Docker | Kubernetes (k8s) | k9s | Linux | Anaconda | Color for figure |
Symbols
# マイナス: -1
-
# ハイフン(ハイフンマイナス) 例: self‐supervised, long short‐term memory, F1‐score, animal‐borne, well‐known
‐
# enダッシュ 例: 20–25 数値の範囲
–
#プラスマイナス
±
# 度
°
# マイクロ
µ
# デルタ
Δ
#
https://www.enago.jp/academy/common-grammatical-errors/
Git & GitHub
.gitignore
https://github.com/github/gitignore
https://www.toptal.com/developers/gitignore
.gitkeep
空のディレクトリを残す
Git Commands
# 初期化(.gitの新規作成)
git init
# ユーザー名とアドレスの登録
git config --global user.name "XXX"
git config --global user.email "XXX@xxx.com"
# リモートリポジトリのクローン
git clone <https://github.com/XXX/XXX.git>
# ディレクトリ名を指定してリモートリポジトリをクローン
git clone <https://github.com/XXX/XXX.git> <dir-name>
# リモートリポジトリを追加(originという名前に設定する)
git remote add origin <https://github.com/XXX/XXX.git>
# リモートリポジトリの確認
git remote -v
# リモートリポジトリの変更
git remote set-url origin <new URL>
# 現在のブランチの状態を確認
git status
# ログの確認
git log
# ログを一行ずつ表示
git log --oneline
# ブランチの一覧を確認
git branch
# 新規ブランチの作成
git branch <new-branch-name>
# ブランチ名の変更
git branch -m <old-branch-name> <new-banch-name>
# ブランチの削除
git branch -d <branch name>
# ブランチの移動
git checkout <branch name>
# フェッチ
git fetch
# ブランチを指定してコメント付きでマージ
git merge <branch-name> -m "comment"
# ブランチを指定してプル (fetch + merge)
git pull origin <branch-name>
# すべての変更をステージ
git add --all
# 特定の変更だけ指定してステージ
git add <filename>
# ステージした全ファイルをを元に戻す
git restore --staged .
# コミット(コメント付き)
git commit -m "comment"
# 直前のコミットの取り消し
git reset --soft "HEAD^"
# ブランチを指定してpush
git push origin <branch name>
# 直前のプッシュの取り消し
git push -f
# タグの確認
git tag
# タグ付け(コメント付き)
git tag -a tag-name -m 'tag comment'
# 指定したtagをpush
git push origin tag-name
# ファイルの削除
git rm -f <filename>
# ファイル名の変更
git mv <old_file> <new_file>
# ディレクトリ名を変更
git mv <old_directory/> <new_direcotry/>
# 直前のプッシュの取り消し
git push -f
# XXX
git
# XXX
git
Docker
# Docker のバージョン確認
docker version
# image の確認 (-aオプション)
docker images
docker image ls
# image の削除
docker image rm <image_name>
docker image rm <image_name1> <image_name2> ...
# 起動中のコンテナの確認(-a オプションで全コンテナを表示)
docker ps
# 各コンテナのDisk使用量を表示
docker system df -v
# コンテナを作成・起動( (pull) → create → start )
--name <container_name>: 作成するコンテナの名前を指定
-p <host_port> <container_port>: ポート番号の指定
-v <host_disk> <container_disk>: ボリュームをマウントする
-d: バックグランド実行
docker run --name <container_name> -d <image_name>
# コンテナの停止
docker stop <container_name>
# コンテナの削除
docker rm <container_name>
# Docker Compose Up
定義ファイルに従って、コンテナ、ボリューム、ネットワークを作成実行する
イメージが存在しない場合は、まずイメージを作成する。既にイメージが存在する場合はコンテナの作成から行う。
-d: バックグランド実行(デーモン)
(docker-compose.ymlがあるディレクトリにて)
docker-compose up -d
-f: docker-compose.yml のパスを指定
docker compose -f </hoge/docker-compose.yml> up -d
# コピー
copy <file name 1> <file name 2>
# コピー
copy <file name 1> <file name 2>
Kubernetes (k8s)
# Manifest File の作成ツールの実行
python cafe_toolkit.py -p ex00/params-om.yaml -t ex00/ex00-dcl.yaml -s om-seed-
# Manifest Fileの実行
kubectl apply -f yaml/ex00-dcl-om-seed-0.yaml
# podの確認
kubectl get pod
# podのlogを確認
--tail: 最新のxx件を表示
--f: リアルタイムフォロー
kubectl logs --tail=20 [pod-name]
# kubectl help
kubectl -h
# kubectl help
kubectl -h
k9s
# install
sudo apt update
sudo apt-get install build-essential procps curl file git
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Enter password
echo "export PATH=/home/linuxbrew/.linuxbrew/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
brew --version
brew install k9s
# k9s を起動
k9s
# readonlyでk9sを起動
k9s --readonly
# k9sの終了
:q or ctrl + c
# STATUSでソート
shift + s
# Search
/
# STATUSでソート
shift + s
# Search
/
Linux
# Ubuntu のバージョン確認
cat /etc/lsb-release
# 実行中の処理の中止
ctrl + c
# コマンドプロンプトの終了
exit
# 以前実行したコマンドを表示
「↑」「↓」
# 補完
Tab キー
Command Prompt/Windows Powershell/Anaconda Prompt/Git Bashのフォント変更
Download fonts from:
https://github.com/edihbrandon/RictyDiminishedOpen Control Panel > Search "font" and got to "View installed fonts" > Copy and paste downloaded fonts here
Open Command Prompt/Windows Powershell and right-click icon > property > change font
Anaconda
# 仮想環境のリスト表示
conda env list
# 新しい仮想環境の作成
conda create -n <new-env>
# PythonのVersionを指定して仮想環境を作成
conda create -n <new-env> python=3.9
# 仮想環境のクローン
conda create -n <new-env> --clone <old-env>
# 仮想環境のアクチベーション
conda activate myenv
# baseベース環境に戻る
conda deactivate
#ライブラリのインストール
conda install <library>
Colors for figure
David Nichols's Color Palette:
['#D81B60', '#1E88E5', '#FFC107', '#004D40']
https://davidmathlogic.com/colorblind/#%23D81B60-%231E88E5-%23FFC107-%23004D40
# Okabe & Ito 8 colors
['#E69F00', '#56B4E9', '#009E73', '#F0E442', '#0072B2', '#D55E00', '#CC79A7', '#000000']
Switch's Color Palette:
['#ff4554', '#00bbdf', '#bad600', '#f02d7d', '#f8b62e', '#8b26a6','#808080']
https://davidmathlogic.com/colorblind/#%23D81B60-%231E88E5-%23FFC107-%23004D40
IBM Color Palette:
['#ffd700', '#ffb14e', '#fa8775', '#ea5f94', '#cd34b5', '#9d02d7', '#0000ff']
https://davidmathlogic.com/colorblind/#%23D81B60-%231E88E5-%23FFC107-%23004D40
Websites that are helpful when choosing colors for figures
Vis Palette: https://projects.susielu.com/viz-palette (IBM)
[David Nichols] [Okabe-Ito version] [Switch]
Others
https://davidmathlogic.com/colorblind/#%23D81B60-%231E88E5-%23FFC107-%23004D40
https://colorbrewer2.org/#type=qualitative&scheme=Paired&n=4
https://thenode.biologists.com/data-visualization-with-flying-colors/research/
Websites that are helpful when choosing colors for figures
Vis Palette: https://projects.susielu.com/viz-palette
https://davidmathlogic.com/colorblind/#%23D81B60-%231E88E5-%23FFC107-%23004D40
https://colorbrewer2.org/#type=qualitative&scheme=Paired&n=4
https://thenode.biologists.com/data-visualization-with-flying-colors/research/
#4682B4
steelblue
R:70 G:130 B180
#F08080
lightcoral
R:240 G:128 B:128
#468189
???
R:70 G:129 B:137
(#588d94)
#BBBBB
grey
#317589
thousand herb
R:49 G:117 B:137
#67A2A0
Yamaaizuri
R:103 G:162 B:160
#5AB5B2
Hanarokusho
R:90 G:181 B:178
#73B8E2
Sora-iro
R:115 G:184 B:226
# VSCodeのステータスバーの色の変更
settings.json ファイルに以下を追加
"workbench.colorCustomizations": {
"statusBar.background": "#4682B4",
"statusBar.noFolderBackground": "#4682B4",
"statusBar.foreground": "#FFFFFF",
}
Use Git in RStudio
for M1 Mac
Homebrewを使ってGitをインストール
RStudioでGitが使えない(認識されない)問題
ターミナルでgitのパスを確認
which git
path
/opt/homebrew/bin/git
いっぽう、RstudioのGlobal Optionsでは
Git executable: /usr/bin/git
になっていてGUIからはどうも変更できない。
そこで、下のリンクの記載に従って
/Users/username/.config/rstudio/rstudio-prefs.json
に以下を追加
"git_exe_path": "/opt/homebrew/bin/git"
これでGitが認識されるようになった。(2022-03-10)
参考URL: https://support.rstudio.com/hc/en-us/articles/200532077?version=1.4.1717&mode=desktop
https://docs.rstudio.com/ide/server-pro/r_sessions/customizing_session_settings.html#user-preferences
https://docs.rstudio.com/ide/server-pro/session_user_settings/session_user_settings.html