Skip to content

Instantly share code, notes, and snippets.

@andmax
Last active April 25, 2024 15:40
Show Gist options
  • Save andmax/8b2a15d18320be0ed9d5271caeed4c0a to your computer and use it in GitHub Desktop.
Save andmax/8b2a15d18320be0ed9d5271caeed4c0a to your computer and use it in GitHub Desktop.
Add runx func. + env.vars. in ~/.bashrc to improve it
# Good run x times function to have readily available in cmd line to
# just do: $ runx 10 cmd args <- run 10 times cmd with args
function runx() {
for ((n=0;n<$1;n++))
do ${*:2}
done
}
# The py_envs can help add a python path before running python or jupyter
# It is used as $ py_envs jupyter notebook
function py_envs() {
PYTHONPATH="$PYTHONPATH:/home/andmax/proj/build-rel/lib/python:/home/andmax/opencv/build/lib/python3" $*
}
# The list_exts can list all unique extensions from current directory,
# it searches and lists recursively
function list_exts() {
find . -type f | sed -rn 's|.*/[^/]+\.([^/.]+)$|\1|p' | sort -u
}
# Good hack to be able to run nvprof in Ampere-based GPUs
export __CUDA_PROF_ENABLE_AMPERE=1
# Good env. vars. to try prevent emacs producing scattered garbage
# characters while running in no-X mode (emacs -nw), it appears
# to be due to special characters in files when opened by emacs,
# close the file and clean with ctrl-l may fix it
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment