-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbashrc.example
More file actions
93 lines (71 loc) · 2.86 KB
/
Copy pathbashrc.example
File metadata and controls
93 lines (71 loc) · 2.86 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
# Example ~/.bashrc for the Bodhi cluster (Slurm)
# Anonymized — replace <username>, hostnames, and account/queue names for your
# own account. Secrets (API tokens, etc.) intentionally omitted: keep those in
# ~/.bashrc.local (sourced at the end) and never commit them.
export TERM=xterm-256color
# Accept a working directory pushed over SSH (e.g. from an editor remote)
if [ -n "$SSH_PWD" ] && [ -d "$SSH_PWD" ]; then
cd "$SSH_PWD"
unset SSH_PWD
fi
### Functions ---------------------------------------------------------------
# ls after every cd
cd() {
builtin cd "$@"
ls -F --color=auto
}
histgrep() {
grep "$@" ~/.history/*
history | grep "$@"
}
today() {
date "+%Y-%m-%d"
}
### Aliases -----------------------------------------------------------------
alias q='exit'
alias df='df -h'
alias la='ls -F -a --color=auto'
alias ls='ls -F --color=auto'
alias ll='ls -hF -l --color=auto'
alias lll='ls -hF -la --color=auto'
alias lr='ls -hF -lagFqt --color=auto | head'
alias rm='rm -i'
alias gzcat='zcat'
# SSH shortcuts — replace hostnames/usernames with your own
alias bodhi='ssh <cluster-head-node>'
# alias alpine="ssh <username>@<other-cluster-login>"
### Environment modules -----------------------------------------------------
if ! [ -z "$MODULESHOME" ]; then
module load modules-init
# module load gcc/10.1.0
fi
### PATH --------------------------------------------------------------------
PATH=${HOME}/bin:${HOME}/.local/bin:${PATH}
export HDF5_PLUGIN_PATH=$HOME/.local/hdf5/lib/plugin
# Rust / cargo
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
# pixi
export PATH="${HOME}/.pixi/bin:$PATH"
export PIXI_CACHE_DIR=/tmp/pixi-cache-${USER}
### Slurm -------------------------------------------------------------------
export PATH="/cluster/slurm-25.11.2/bin:/cluster/slurm-25.11.2/sbin:$PATH"
export SBATCH_ACCOUNT="<account>"
export SBATCH_PARTITION="<partition>"
# my jobs
alias sq='squeue -u $USER -o "%.10i %.9P %.30j %.8u %.2t %.10M %.10L %.4C %.8m %R"'
# my jobs, live-refreshing (needs hwatch)
alias wsq='hwatch -n 5 "squeue -u \$USER -o \"%.10i %.9P %.50k %.8T %.10M %.10L %.6D %.4C %.8m %R %.10Q\""'
# another user's jobs, live-refreshing: wsqu <username>
wsqu() {
local user="${1:?Usage: wsqu <username>}"
hwatch -n 5 "squeue -u $user -o \"%.10i %.9P %.50k %.8T %.10M %.10L %.6D %.4C %.8m %R %.10Q\""
}
### Node / direnv / prompt --------------------------------------------------
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
command -v direnv >/dev/null && eval "$(direnv hook bash)"
command -v starship >/dev/null && eval "$(starship init bash)"
### Local secrets (not committed) -------------------------------------------
# Put tokens/keys here, e.g. export NETLIFY_AUTH_TOKEN=...
[ -f "$HOME/.bashrc.local" ] && . "$HOME/.bashrc.local"