Skip to content

Instantly share code, notes, and snippets.

@theptrk
Last active January 8, 2024 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theptrk/60e8e08546f8164d33810e1bd04dcdb9 to your computer and use it in GitHub Desktop.
Save theptrk/60e8e08546f8164d33810e1bd04dcdb9 to your computer and use it in GitHub Desktop.
alias did='vim ~/did.txt'
alias todo='vim ~/todo.txt'
alias zrc='vim ~/.oh-my-zsh/custom/myaliases.zsh'
alias zs='exec zsh'
alias gotodidlist='cd ~/projamming/todidlistdjango/todidlist'
alias ls='ls -1p'
alias rm='rm -i'
alias ga='git add'
alias gs='git status'
alias gd='git diff'
alias gdc='git diff --cached'
alias gcm='git commit -m'
alias goto='git checkout'
alias gpob='git push --set-upstream origin `git rev-parse --abbrev-ref HEAD`'
alias gpmh='git push origin master && git push heroku master'
tre() {
local depth="$1"
local directory="$2"
# Default depth to 2 if not provided
if [ -z "$depth" ]; then
depth=1
fi
# Default directory to . if not provided
if [ -z "$directory" ]; then
directory="."
fi
tree -L "$depth" "$directory" | less
}
# zsh glob complete means you can do something like "<path>/*<string>"
# and still use <tab> to complete and fill in the filename
setopt GLOB_COMPLETE
# why? sometimes when you computer dies, it leaves a hanging postgres services
# https://dba.stackexchange.com/questions/75214/postgresql-not-running-on-mac
function restartpg {
brew services restart postgresql \
&& brew services stop postgresql \
&& rm -f /usr/local/var/postgres/postmaster.pid \
&& brew services start postgresql \
&& sleep 5 \
&& psql --list
}
# https://lifesaver.codes/answer/warning-pyenv-init-no-longer-sets-path-1906
# export PYENV_ROOT="$HOME/.pyenv"
# export PATH="$PYENV_ROOT/bin:$PATH"
# if command -v pyenv 1>/dev/null 2>&1; then
# eval "$(pyenv init --path)"
# fi
#
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
eval "$(rbenv init -)"
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
# __conda_setup="$('/Users/patricktran/opt/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
# if [ $? -eq 0 ]; then
# eval "$__conda_setup"
# else
# if [ -f "/Users/patricktran/opt/miniconda3/etc/profile.d/conda.sh" ]; then
# . "/Users/patricktran/opt/miniconda3/etc/profile.d/conda.sh"
# else
# export PATH="/Users/patricktran/opt/miniconda3/bin:$PATH"
# fi
# fi
# unset __conda_setup
# <<< conda initialize <<<
# my homemade conda starter
alias ca='conda activate "${PWD##*/}"'
alias pmr='python manage.py runserver'
alias work='source env/bin/activate'
alias eba='source env/bin/activate'
alias unwork='deactivate'
alias ebd='deactivate'
alias capmr='ca && pmr'
alias shell_plus='python manage.py shell_plus'
export DJANGO_READ_DOT_ENV_FILE=True
# eval "$(pyenv init -)"
# oh-my-zsh made "git" commands full page
# https://stackoverflow.com/questions/48341920/git-branch-command-behaves-like-less
export LESS=-FRX
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment