Skip to content

Instantly share code, notes, and snippets.

@z-a-f
Created September 27, 2024 02:05
Show Gist options
  • Save z-a-f/39cba96cb698f3a267f8a3a6fb068619 to your computer and use it in GitHub Desktop.
Save z-a-f/39cba96cb698f3a267f8a3a6fb068619 to your computer and use it in GitHub Desktop.
# set -x
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
## Local paths
USER_BIN="${HOME}/bin"
LOCAL_USER_BIN="${HOME}/.local/bin"
export PATH="${USER_BIN}${PATH:+:${PATH}}"
export PATH="${LOCAL_USER_BIN}${PATH:+:${PATH}}"
################################################################################
## Oh My Zsh ##
# Path to your oh-my-zsh installation.
# export ZSH="/home/takeshi/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
# ZSH_THEME="zaf"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work)
# See https://github.com/ohmyzsh/ohmyzsh/issues/5765
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# History size
HISTFILE=~/.zsh_history
HISTSIZE=999999
SAVEHIST=$HISTSIZE
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
# plugins=(git)
# source $ZSH/oh-my-zsh.sh
## Oh My Zsh ##
################################################################################
################################################################################
## Oh My Posh ##
# export OMP=${HOME}/.cache/oh-my-posh
export OMP=${HOME}/bin/oh-my-posh
OMP_THEME=${HOME}/dotfiles/.oh-my-posh-theme.omp.json
eval "$(oh-my-posh init zsh --config ${OMP_THEME})"
## Oh My Posh ##
################################################################################
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# System aliases
alias abspath='which abspath || python -c "import os,sys; print os.path.abspath(sys.argv[1])"' # This is just a hack
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias cp='cp -rvi'
alias cppcheck='cppcheck --enable=all --inconclusive --std=posix --language=c++'
alias dog='highlight -O xterm256 --failsafe'
alias du='du -ch -d 1'
alias ekill="emacsclient -e '(kill-emacs)'"
alias em='emacs -nw' # No X11 windows
alias emacsd='emacs --daemon'
alias emax='emacsclient -t'
alias eqq='emacs -nw -Q' # No config and no X11
alias ff="grep -rnw '.' -e "
alias kotl="kotlinc-jfvm"
alias ls='ls -GFh --color'
alias ll='ls -GFhal --color'
alias mkdir='mkdir -pv'
alias mv="mv -i"
alias nano='nano -c'
alias pig='pygmentize -g'
alias rm='rm -vi'
# alias todo='xargs -I{} git grep -nEIi "TODO\s*\({}\)" <<<'
alias todo='xargs -I{} git grep -EIi "TODO\({}\)" <<<'
alias tw='open -a /Applications/TextWrangler.app'
alias valgrind='valgrind --leak-check=full --tool=memcheck'
# Third-party stuff
alias gclogin='gcloud auth application-default login'
alias pykernel='xargs -I{} python -m ipykernel install --user --name {} --display-name "Python \({}\)" <<< '
# Custom paths
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/usr/local/google-cloud-sdk/path.zsh.inc' ]; then . '/usr/local/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/usr/local/google-cloud-sdk/completion.zsh.inc' ]; then . '/usr/local/google-cloud-sdk/completion.zsh.inc'; fi
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" --no-use # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
################################################################################
# Custom global variables. Make sure there is an explanation why we use global!
################################################################################
# `nvidia-smi` uses PCI-E id when enumerating the GPUs, however, when using
# CUDA_VISIBLE_DEVICES, we need to obey the CUDA_DEVICE_ORDER. Setting it to
# fastest first will preven the change in the PCI-E bus id from using differnt
# GPU. Available options: FASTEST_FIRST and PCI_BUS_ID
export CUDA_DEVICE_ORDER=FASTEST_FIRST
# >>> mamba initialize >>>
# !! Contents within this block are managed by 'mamba init' !!
export MAMBA_EXE="${USER_BIN}/micromamba";
export MAMBA_ROOT_PREFIX="${HOME}/micromamba";
__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 micromamba="$MAMBA_EXE" # Fallback on help from mamba activate
fi
unset __mamba_setup
# <<< mamba initialize <<<
alias micro='micromamba'
alias conda='micromamba'
################################################################################
# Custom executables
################################################################################
# DirEnv
type direnv >/dev/null 2>&1 && eval "$(direnv hook zsh)"
# Python CUDA check
# Lottie -- this is optional, only used for animations and vector graphics
LOTTIE_PATH="${HOME}/Desktop/Git/python-lottie"
LOTTIE_URL="https://gitlab.com/mattbas/python-lottie"
if [ ! -d "${LOTTIE_PATH}" ]; then
git clone "${LOTTIE_URL}" "${LOTTIE_PATH}"
fi
export PATH="${LOTTIE_PATH}/bin${PATH:+:${PATH}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment