Last active
January 21, 2023 09:46
-
-
Save ozgurkalan/3597fb5dfb3310596cad448982af5401 to your computer and use it in GitHub Desktop.
BASH Profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#reload this profile ** required after bash changes | |
alias reloadme="source ~/.zshrc" | |
# ..or | |
alias reloadme=zsh | |
# open bash profile in sublime | |
alias subash="sublime ~/.bashrc" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## after installing brew and bash-completion | |
# bash-completion | |
if [ -f /sw/etc/bash_completion ]; then | |
. /sw/etc/bash_completion | |
fi | |
# completion init | |
autoload -U compinit && compinit | |
# may be included in conda init or out side | |
eval "`pip completion --zsh`" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
oz(){ | |
# >>> conda initialize >>> | |
# !! Contents within this block are managed by 'conda init' !! | |
__conda_setup="$('/Users/ozgurkalan/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" | |
if [ $? -eq 0 ]; then | |
eval "$__conda_setup" | |
else | |
if [ -f "/Users/ozgurkalan/opt/anaconda3/etc/profile.d/conda.sh" ]; then | |
. "/Users/ozgurkalan/opt/anaconda3/etc/profile.d/conda.sh" | |
else | |
export PATH="/Users/ozgurkalan/opt/anaconda3/bin:$PATH" | |
fi | |
fi | |
unset __conda_setup | |
# <<< conda initialize <<< | |
eval "`pip completion --zsh`" | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# docker tty, self VM bash screen | |
alias docker_bash="docker run -it --rm --privileged --pid=host alpine nsenter -t 1 -m -u -n -i sh" | |
# docker info | |
d(){ | |
clear | |
echo "images------------------------" | |
docker images | |
echo " " | |
echo "volumes------------------------" | |
docker volume ls | |
echo " " | |
echo "network------------------------" | |
docker network ls | |
echo " " | |
echo "containers------------------------" | |
docker ps -a | |
} | |
alias dc="docker-compose" | |
alias dcup="dc up -d --build" | |
alias dcdown="dc down -v --remove-orphans" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# git start-over | |
# remove all files and init again with an initial commit | |
git_restart(){ | |
echo "this may take some time, be patient..." | |
rm -rf .git | |
git init | |
git add . | |
git commit -am "initial commit by OZ" | |
echo "restarted git..." | |
} | |
### derived from jeffreyWay alias for git | |
## git_undo : undo everything since last commit, incl new files | |
alias git_undo="git reset --hard && git clean -df" | |
## git_co: commit current changes | |
alias git_co="git add . && git commit -m 'WiP'" | |
## git_log: log the git | |
alias git_log="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" | |
### git branch in terminal | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
setopt PROMPT_SUBST | |
# PROMPT='%9c%{%F{green}%}$(parse_git_branch)%{%F{none}%} $ | |
#Change Terminal prompt name as working folder name | |
PROMPT='%F{cyan}%1~%f$(parse_git_branch)% $ ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip grep | |
pipi () { | |
pip list | grep -i $1 | |
} | |
#python | |
alias py="python" | |
# Jupyter | |
alias jpy="oz && ozpy && jupyter notebook --browser=safari" | |
#Jupyter Lab alias | |
alias jul="Jupyter lab" | |
# which python, pip | |
w(){ | |
pwd | |
which python | |
which pip | |
py -V | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#VS Code | |
code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;} | |
#sublime IDE | |
alias sub="sublime" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment