-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzshrc
More file actions
274 lines (221 loc) · 7.98 KB
/
Copy pathzshrc
File metadata and controls
274 lines (221 loc) · 7.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# Created by Marjori Pomarole
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
ZSH_THEME="tonotdo"
HIST_STAMPS="yyyy-mm-dd"
plugins=(git python vi-mode)
source $ZSH/oh-my-zsh.sh
PROMPT='%{$fg_no_bold[magenta]%}➜%{$fg_no_bold[green]%}%3~$(git_prompt_info)%{$reset_color%}» '
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
# ssh
export SSH_KEY_PATH="~/.ssh/id_ed25519"
ssh-add --apple-use-keychain ~/.ssh/id_ed25519 2>/dev/null
ssh-add --apple-use-keychain ~/.ssh/id_ed25519_hcl 2>/dev/null
setopt auto_cd # Change Directory by typing a directory name on its own
setopt extended_glob # Turn on the more powerful pattern matching features
setopt append_history # All shells terminated have a chance to save to ~/.history
setopt share_history # Commands saved to ~/.history so they can be shared across shells
setopt hist_ignore_dups # Ignore consecutive duplicates
setopt hist_find_no_dups # Ignore duplicates when searching back
setopt numericglobsort # any range in pattern <-> is sorted
unsetopt correct_all
bindkey "^R" history-incremental-search-backward
HISTSIZE=1000000
SAVEHIST=1000000
HISTFILE=~/.history
fpath+=~/.zfunc
autoload -Uz compinit
if [[ -n ${ZDOTDIR}/.zcompdump(#qN.mh+24) ]]; then
compinit
else
compinit -C
fi
autoload -U bashcompinit
bashcompinit
# Aliases
alias ll='ls -alsh'
alias grep='grep --color=auto'
alias nuke='pkill -u $(whoami)'
alias myip='ifconfig | grep inet'
alias du='du -ch'
alias untar='tar xvf'
alias pid='ps -el | head -1 && ps -el | grep $1'
alias k='kubectl'
alias g=git
alias gst='git status -b --short'
alias gd='git diff'
alias gb='git branch'
alias gba='git branch -a'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gcam='git add --all; git commit --all -v -m'
alias gco='git checkout'
alias gcount='git shortlog -sn'
alias gcp='git cherry-pick'
alias gdv='git diff -w "$@" | vim -R -'
alias gl='git pull'
alias glg='git log --stat --max-count=5'
alias gp='git push'
alias gup='git fetch && git rebase'
alias glol='git log --pretty=format:"%h%x09%an%x09%ad%x09%s" --graph --date=short'
alias pip="pip3"
alias python="python3"
# brew libraries
export LDFLAGS="-L/opt/homebrew/opt/openssl/lib"
export CFLAGS="-I/opt/homebrew/opt/openssl/include"
export USER=marjoripomarole
export GITHUBUSERNAME=marjoripomarole
export EDITOR=vim
export GIT_EDITOR=vim
export VISUAL=vim
# poetry
export PATH="/Users/marjoripomarole/.local/bin:$PATH"
# Added by Windsurf
export PATH="/Users/marjoripomarole/.codeium/windsurf/bin:$PATH"
# Added by Antigravity
export PATH="/Users/marjoripomarole/.antigravity/antigravity/bin:$PATH"
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/marjoripomarole/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/marjoripomarole/miniconda3/etc/profile.d/conda.sh" ]; then
. "/Users/marjoripomarole/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/marjoripomarole/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
# >>> mamba initialize >>>
# !! Contents within this block are managed by 'mamba shell init' !!
export MAMBA_EXE='/Users/marjoripomarole/miniconda3/bin/mamba';
export MAMBA_ROOT_PREFIX='/Users/marjoripomarole/.local/share/mamba';
__mamba_setup="$("$MAMBA_EXE" shell hook --shell zsh --root-prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__mamba_setup"
else
alias mamba="$MAMBA_EXE" # Fallback on help from mamba activate
fi
unset __mamba_setup
# <<< mamba initialize <<<
# >>> juliaup initialize >>>
# !! Contents within this block are managed by juliaup !!
path=('/Users/marjoripomarole/.juliaup/bin' $path)
export PATH
# Tab completion for juliaup and julia channel selection
[ -f "/Users/marjoripomarole/.julia/juliaup/completions/zsh.zsh" ] && source "/Users/marjoripomarole/.julia/juliaup/completions/zsh.zsh"
# <<< juliaup initialize <<<
# --- GPU ---
alias gpu='nvidia-smi --query-gpu=index,name,utilization.gpu,memory.used,memory.total,temperature.gpu --format=csv,noheader'
alias gpuwatch='watch -n1 nvidia-smi'
alias gpumem='nvidia-smi --query-gpu=memory.used,memory.total --format=csv,noheader'
alias gpuprocs='nvidia-smi --query-compute-apps=pid,name,used_memory --format=csv'
# --- Training control ---
alias killtraining='pkill -f "python.*train"'
killtrain() {
if [ -z "$1" ]; then
pkill -f "python.*train"
echo "Killed all python training processes"
else
pkill -f "$1"
echo "Killed processes matching: $1"
fi
}
# --- Virtual environments ---
alias ae='source .venv/bin/activate'
alias de='deactivate'
alias mkvenv='python -m venv .venv && source .venv/bin/activate'
alias uvvenv='uv venv && source .venv/bin/activate'
# --- Log watching ---
alias watchloss='tail -f logs/*.log | grep --line-buffered "loss"'
alias watchacc='tail -f logs/*.log | grep --line-buffered "accuracy\|acc"'
alias watcherr='tail -f logs/*.log | grep --line-buffered "ERROR\|error\|Exception"'
taillog() {
local pattern="${1:-loss}"
tail -f logs/*.log 2>/dev/null | grep --line-buffered "$pattern"
}
# --- Disk space (training data fills disks fast) ---
alias diskuse='df -h .'
alias bigfiles='find . -type f -size +100M | xargs du -h 2>/dev/null | sort -rh | head -20'
alias bigmodels='find . \( -name "*.pt" -o -name "*.pth" -o -name "*.safetensors" -o -name "*.ckpt" -o -name "*.bin" \) | xargs du -h 2>/dev/null | sort -rh | head -20'
# --- Quick environment checks ---
alias checkgpu='python -c "import torch; print(f\"CUDA: {torch.cuda.is_available()}\"); print(f\"Device: {torch.cuda.get_device_name(0)}\") if torch.cuda.is_available() else None"'
alias checkcuda='env | grep -i cuda'
alias checkenv='python --version && pip --version && python -c "import torch; print(f\"PyTorch {torch.__version__}, CUDA {torch.cuda.is_available()}\")" 2>/dev/null'
# --- tmux shortcuts ---
alias ta='tmux attach -t'
alias tls='tmux ls'
alias tn='tmux new -s'
alias tk='tmux kill-session -t'
trainenv() {
local name="${1:-train}"
tmux new-session -d -s "$name"
tmux split-window -h -t "$name"
tmux split-window -v -t "$name"
tmux send-keys -t "$name:0.1" 'watch -n1 nvidia-smi' C-m
tmux send-keys -t "$name:0.2" 'htop' C-m
tmux select-pane -t "$name:0.0"
tmux attach -t "$name"
}
# --- SSH helpers ---
syncto() {
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: syncto <host> <remote_path> [local_path]"
echo "Example: syncto gpu ~/data ./data"
return 1
fi
local host="$1"
local remote="$2"
local local_path="${3:-.}"
rsync -avz --progress "$local_path" "${host}:${remote}"
}
syncfrom() {
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: syncfrom <host> <remote_path> [local_path]"
echo "Example: syncfrom gpu ~/results ./results"
return 1
fi
local host="$1"
local remote="$2"
local local_path="${3:-.}"
rsync -avz --progress "${host}:${remote}" "$local_path"
}
# --- Experiment management ---
newexp() {
local name="${1:-experiment}"
local dir="experiments/${name}_$(date +%Y%m%d_%H%M%S)"
mkdir -p "$dir/logs" "$dir/checkpoints" "$dir/configs"
echo "Created experiment directory: $dir"
echo "$dir"
}
lastexp() {
ls -dt experiments/*/ 2>/dev/null | head -1
}
# --- Model download helpers ---
hfdownload() {
if [ -z "$1" ]; then
echo "Usage: hfdownload <model_id> [filename]"
echo "Example: hfdownload meta-llama/Llama-2-7b config.json"
return 1
fi
local model="$1"
local file="${2:-}"
if [ -n "$file" ]; then
wget "https://huggingface.co/${model}/resolve/main/${file}"
else
echo "Cloning full repo (use git-lfs)..."
git lfs install
git clone "https://huggingface.co/${model}"
fi
}
# --- Process management ---
memhogs() {
ps aux --sort=-%mem 2>/dev/null | head -11 || ps aux -m | head -11
}
psg() {
ps aux | grep -v grep | grep -i "$1"
}