Skip to content

Commit e63399a

Browse files
committed
Update bash and zsh configs for use on CSC clusters
1 parent d6e6f69 commit e63399a

6 files changed

Lines changed: 106 additions & 26 deletions

File tree

.bashrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file is for environments where it's not possible to change the login shell with chsh.
2+
# Do not use this if you can change your login shell.
3+
4+
# Check that the session is interactive.
5+
# https://askubuntu.com/a/1491731
6+
if [[ $- == *i* ]]; then
7+
if command -v zsh &> /dev/null; then
8+
# https://askubuntu.com/a/1292415
9+
export SHELL=`which zsh`
10+
zsh
11+
fi
12+
fi

.profile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ if [ -d "$HOME/.local/bin" ] ; then
2626
PATH="$HOME/.local/bin:$PATH"
2727
fi
2828

29+
# Rust Cargo
2930
if [ -f "${HOME}/.cargo/env" ]; then
3031
. "${HOME}/.cargo/env"
3132
fi

physics/csc/.bashrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

zsh/.zshrc

Lines changed: 60 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -113,30 +113,60 @@ source "${HOME}/.zgen/zgen.zsh"
113113
if ! zgen saved; then
114114
# Plugins
115115
zgen oh-my-zsh
116-
zgen oh-my-zsh plugins/adb
117-
zgen oh-my-zsh plugins/asdf
118-
zgen oh-my-zsh plugins/autojump
119-
zgen oh-my-zsh plugins/celery
120116
zgen oh-my-zsh plugins/colored-man-pages
121117
zgen oh-my-zsh plugins/cp
122-
zgen oh-my-zsh plugins/docker
123-
zgen oh-my-zsh plugins/git
124-
zgen oh-my-zsh plugins/npm
125-
zgen oh-my-zsh plugins/nvm
126-
zgen oh-my-zsh plugins/pip
127-
zgen oh-my-zsh plugins/pylint
128-
zgen oh-my-zsh plugins/rsync
129-
zgen oh-my-zsh plugins/screen
130-
zgen oh-my-zsh plugins/ubuntu
131-
zgen oh-my-zsh plugins/ufw
132-
zgen oh-my-zsh plugins/virtualenv
133-
zgen oh-my-zsh plugins/vscode
134-
zgen oh-my-zsh plugins/web-search
118+
zgen oh-my-zsh plugins/git # Git is already required for downloading oh-my-zsh.
135119
zgen load marlonrichert/zsh-autocomplete
136-
zgen load sobolevn/wakatime-zsh-plugin
137120
zgen load zsh-users/zsh-autosuggestions
138121
zgen load zsh-users/zsh-syntax-highlighting
139122

123+
# Optional features in alphabetical order
124+
if command -v adb &> /dev/null; then
125+
zgen oh-my-zsh plugins/adb
126+
fi
127+
if command -v asdf &> /dev/null; then
128+
zgen oh-my-zsh plugins/asdf
129+
fi
130+
if command -v autojump &> /dev/null; then
131+
zgen oh-my-zsh plugins/autojump
132+
fi
133+
if command -v docker &> /dev/null; then
134+
zgen oh-my-zsh plugins/docker
135+
fi
136+
if command -v npm &> /dev/null; then
137+
zgen oh-my-zsh plugins/npm
138+
fi
139+
if command -v nvm &> /dev/null; then
140+
zgen oh-my-zsh plugins/nvm
141+
fi
142+
if command -v python3 &> /dev/null; then
143+
zgen oh-my-zsh plugins/celery
144+
zgen oh-my-zsh plugins/pip
145+
zgen oh-my-zsh plugins/pylint
146+
zgen oh-my-zsh plugins/virtualenv
147+
fi
148+
if command -v rsync &> /dev/null; then
149+
zgen oh-my-zsh plugins/rsync
150+
fi
151+
if command -v screen &> /dev/null; then
152+
zgen oh-my-zsh plugins/screen
153+
fi
154+
if lsb_release -a | grep -q "Ubuntu"; then
155+
zgen oh-my-zsh plugins/ubuntu
156+
fi
157+
if command -v ufw &> /dev/null; then
158+
zgen oh-my-zsh plugins/ufw
159+
fi
160+
if command -v code &> /dev/null; then
161+
zgen oh-my-zsh plugins/vscode
162+
fi
163+
if [ -f "${HOME}/.wakatime.cfg" ]; then
164+
zgen load sobolevn/wakatime-zsh-plugin
165+
fi
166+
if command -v firefox &> /dev/null; then
167+
zgen oh-my-zsh plugins/web-search
168+
fi
169+
140170
# Theme
141171
zgen load romkatv/powerlevel10k powerlevel10k
142172

@@ -322,7 +352,7 @@ if [ -f $STDERRED_PATH ]; then
322352
red_colored_text=$(tput setaf 9)
323353
export STDERRED_ESC_CODE=`echo -e "$red_colored_text"`
324354
else
325-
echo "stderred was not found. Please install it or remove it from .zshrc."
355+
# echo "stderred was not found. Please install it or remove it from .zshrc."
326356
fi
327357
unset STDERRED_PATH
328358

@@ -339,15 +369,15 @@ if command -v gem &> /dev/null; then
339369
if [ -f "${COLORLS_FILE_PATH}" ]; then
340370
COLORLS_PATH="$(dirname "${COLORLS_FILE_PATH}")"
341371
source "${COLORLS_PATH}/tab_complete.sh"
372+
alias lc='colorls -lA --sd'
342373
else
343-
echo "Colorls was not found. Please install it with \"gem install colorls\" or remove it form .zshrc."
374+
# echo "Colorls was not found. Please install it with \"gem install colorls\" or remove it form .zshrc."
344375
fi
345376
unset COLORLS_FILE_PATH
346377
unset COLORLS_PATH
347378
else
348379
echo "Gem was not found. Please install Ruby."
349380
fi
350-
alias lc='colorls -lA --sd'
351381

352382
# Powerline
353383
# https://github.com/powerline/powerline
@@ -381,7 +411,15 @@ fi
381411
# Fix ROCm OpenCL
382412
# By default clinfo and other OpenCL applications might not see the ROCm driver.
383413
if [ -d "/opt/rocm" ]; then
384-
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/rocm/lib:/opt/rocm/opencl/lib"
414+
# Do not change the configuration on clusters, as they have their own driver setup.
415+
if command -v srun &> /dev/null; then :; else
416+
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/rocm/lib:/opt/rocm/opencl/lib"
417+
fi
418+
fi
419+
420+
# This prevents the "disk quota exceeded" error when building Apptainer containers on CSC servers.
421+
if [ -z "${TMPDIR}" ]; then
422+
APPTAINER_CACHEDIR=$TMPDIR
385423
fi
386424

387425
# -----

zsh/custom/csc.zsh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env zsh
2+
3+
csc-info-all() {
4+
# Puhti and Mahti
5+
if command -v csc-workspaces &> /dev/null; then
6+
csc-workspaces
7+
csc-info
8+
fi
9+
10+
# LUMI
11+
if command -v lumi-workspaces &> /dev/null; then
12+
lumi-workspaces
13+
# lumi-quota # This is included in lumi-workspaces
14+
# lumi-allocations # This is included in lumi-workspaces
15+
lumi-ldap-userinfo
16+
fi
17+
18+
module list
19+
20+
echo "Currently running Slurm jobs:"
21+
squeue -u $USER
22+
23+
echo "Slurm info:"
24+
sinfo
25+
}
26+
27+
if [ -d "/scratch/project_462000956/${USER}/summerschool" ]; then
28+
alias summerschool="cd /scratch/project_462000956/${USER}/summerschool; clear"
29+
fi

zsh/custom/utils.zsh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ update() {
237237
# You can disable the completions for specific commands by deleting the files here.
238238
# rm "${FISH_COMPLETION_DIR}/_git*"
239239
else
240-
echo "Please install fish for zsh-manpage-completion-generator" > /dev/stderr
240+
# echo "Please install fish for zsh-manpage-completion-generator" > /dev/stderr
241241
fi
242242
}
243243

@@ -265,7 +265,8 @@ alias modem="sudo ${HOME}/Git/linux-scripts/modem.py"
265265
# alias nvim="flatpak run io.neovim.nvim"
266266
# fi
267267

268-
# The "; :" discards any additional arguments
268+
# A joke for typoing the command "apt".
269+
# The "; :" discards any additional arguments.
269270
alias pat="image headpat; :"
270271

271272
# Easy pinging
@@ -280,6 +281,7 @@ if ! command -v rocm-smi &> /dev/null && [ -f "/opt/rocm/bin/rocm-smi" ]; then
280281
alias rocm-smi="/opt/rocm/bin/rocm-smi"
281282
fi
282283

284+
# RTFM = Read The Fucking Manual :D
283285
alias rtfm="man"
284286

285287
# Print most recently modified files in current directory. It takes no arguments

0 commit comments

Comments
 (0)