Skip to content

Instantly share code, notes, and snippets.

@DrBluefall
Created July 17, 2019 16:02
Show Gist options
  • Save DrBluefall/087cfc5cbf7d6299f94ee766edc7195b to your computer and use it in GitHub Desktop.
Save DrBluefall/087cfc5cbf7d6299f94ee766edc7195b to your computer and use it in GitHub Desktop.
#!/usr/bin/zsh
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
source $ZSH/oh-my-zsh.sh
plugins=(
git
iterm2
macports
man
osx
python
composer
zsh-syntax-highlighting
zsh-autosuggestions
)
ZSH_THEME="powerlevel10k/powerlevel10k"
POWERLEVEL9K_MODE='nerdfont-complete'
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 change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# 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.
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.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# 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? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
source $ZSH/oh-my-zsh.sh
# 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"
# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"
# 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`.
alias python="python3"
alias py3="python3"
alias status="git status"
alias stage="git add"
alias commit="git commit -m"
alias push="git push --all"
alias vscode='code-insiders'
alias "dvenv"="deactivate"
alias "acenv"="source .venv/bin/activate"
alias "mkenv"="python3 -m venv .venv"
alias "rmenv"="rm -rf .venv"
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
#
POWERLEVEL9K_CUSTOM_WIFI_SIGNAL="zsh_wifi_signal"
POWERLEVEL9K_CUSTOM_WIFI_SIGNAL_BACKGROUND="white"
POWERLEVEL9K_CUSTOM_WIFI_SIGNAL_FOREGROUND="black"
zsh_wifi_signal(){
local output=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I)
local airport=$(echo $output | grep 'AirPort' | awk -F': ' '{print $2}')
if [ "$airport" = "Off" ]; then
local color='%F{black}'
echo -n "%{$color%}Wifi Off"
else
local ssid=$(echo $output | grep ' SSID' | awk -F': ' '{print $2}')
local speed=$(echo $output | grep 'lastTxRate' | awk -F': ' '{print $2}')
local color='%F{black}'
[[ $speed -gt 100 ]] && color='%F{black}'
[[ $speed -lt 50 ]] && color='%F{red}'
echo -n "%{$color%}$speed Mbps \uf1eb%{%f%}" # removed char not in my PowerLine font
fi
}
startup(){
old_wd=$(pwd)
if [ $1 = "prisbot" ];
then
cd /Users/prismarine/Desktop/projects/ProjectPrismarine
source .venv/bin/activate
git pull --all
if [ $# -eq 2 ];
then
git checkout $2
else
git checkout master
fi
pip install -r requirements.txt
python3 core.py
echo -e "startup: \e[38;5;10mLogout complete - returning to previous working directory\e[0m."
deactivate
cd $old_wd
elif [ $1 = "otd" ];
then
cd /Users/prismarine/Desktop/projects/offthedialbot
source .venv/bin/activate
git pull --all
if [ $# -eq 2 ];
then
git checkout $2
else
git checkout master
fi
pip install -r requirements.txt
cd src
python3 offthedialbot.py
echo -e "startup: \e[38;5;10mLogout complete - returning to previous working directory\e[0m."
deactivate
cd $old_wd
else
echo -e "startup: \e[38;5;9mInvalid Project\e[0m: $1"
return 1
fi
}
edit(){
if [ $1 = "prisbot" ];
then
cd /Users/prismarine/Desktop/projects/ProjectPrismarine
source .venv/bin/activate
git pull --all
if [ $# -eq 2 ];
then
git checkout $2
else
git checkout master
fi
pip install -r requirements.txt
vscode /Users/prismarine/Desktop/projects/ProjectPrismarine
elif [ $1 = "otd" ];
then
cd /Users/prismarine/Desktop/projects/offthedialbot
source .venv/bin/activate
git pull --all
if [ $# -eq 2 ];
then
git checkout $2
else
git checkout master
fi
pip install -r requirements.txt
vscode /Users/prismarine/Desktop/projects/offthedialbot
elif [ $1 = "zshrc" ];
then
cd ~
vscode .zshrc
else
echo -n "edit: \e[38;5;9mInvalid Project\e[0m: $1"
return 1
fi
}
venv(){
if [ $1 = "-a" ];
then
source .venv/bin/activate
elif [ $1 = "-d" ];
then
deactivate
elif [ $1 = "-c" ];
then
python3 -m venv .venv
elif [ $1 = "-rm" ];
then
rm -rf .venv
else
echo -e "venv: \e[38;5;9mInvalid option\e[0m: $1"
return 1
fi
}
reload(){
clear
source ~/.zshrc
}
zsh_git_link() {
if [ -e .git ];
then
link=$(basename -s .git `git config --get remote.origin.url`)
echo -n $link
fi
}
POWERLEVEL9K_CUSTOM_GIT_LINK='zsh_git_link'
POWERLEVEL9K_CUSTOM_GIT_LINK_BACKGROUND='green'
POWERLEVEL9K_CUSTOM_GIT_LINK_FOREGROUND='grey'
POWERLEVEL9K_CONTEXT_TEMPLATE='%n'
POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND='white'
POWERLEVEL9K_BATTERY_CHARGING='yellow'
POWERLEVEL9K_BATTERY_CHARGED='green'
POWERLEVEL9K_BATTERY_DISCONNECTED='$DEFAULT_COLOR'
POWERLEVEL9K_BATTERY_LOW_THRESHOLD='10'
POWERLEVEL9K_BATTERY_LOW_COLOR='red'
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='\n%F{196}\u256d\u2500'
#POWERLEVEL9K_BATTERY_STAGES=($'\u2581 ' $'\u2582 ' $'\u2583 ' $'\u2584 ' $'\u2585 ' $'\u2586 ' $'\u2587 ' $'\u2588 ')
POWERLEVEL9K_BATTERY_ICON='\uf1e6 '
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX="%F{196}\u251c\u2500"
#POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="❱ "
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%F{196}\u2570\u2500%F{196}\uF460%F{124}\uF460%F{243}\uF460%f "
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow'
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='red'
POWERLEVEL9K_VCS_UNTRACKED_ICON='\uf12a'
POWERLEVEL9K_SHOW_CHANGESET=true
POWERLEVEL9K_CHANGESET_HASH_LENGTH=7
POWERLEVEL9K_DIR_BACKGROUND='001'
POWERLEVEL9K_DIR_FOREGROUND='007'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon context battery dir_writable dir virtualenv custom_git_link vcs newline load ram custom_wifi_signal time status command_execution_time)
#POWERLEVEL9K_SHORTEN_STRATEGY="truncate_middle"
#POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
POWERLEVEL9K_TIME_FORMAT="%D{%H:%M %d/%m/%y}"
POWERLEVEL9K_TIME_BACKGROUND='white'
POWERLEVEL9K_RAM_BACKGROUND='yellow'
POWERLEVEL9K_LOAD_CRITICAL_BACKGROUND="white"
POWERLEVEL9K_LOAD_WARNING_BACKGROUND="white"
POWERLEVEL9K_LOAD_NORMAL_BACKGROUND="white"
POWERLEVEL9K_LOAD_CRITICAL_FOREGROUND="red"
POWERLEVEL9K_LOAD_WARNING_FOREGROUND="yellow"
POWERLEVEL9K_LOAD_NORMAL_FOREGROUND="black"
POWERLEVEL9K_LOAD_CRITICAL_VISUAL_IDENTIFIER_COLOR="red"
POWERLEVEL9K_LOAD_WARNING_VISUAL_IDENTIFIER_COLOR="yellow"
POWERLEVEL9K_LOAD_NORMAL_VISUAL_IDENTIFIER_COLOR="green"
POWERLEVEL9K_HOME_ICON='\uf015'
POWERLEVEL9K_HOME_SUB_ICON=''
POWERLEVEL9K_FOLDER_ICON='\ue5ff'
POWERLEVEL9K_STATUS_VERBOSE=true
POWERLEVEL9K_STATUS_CROSS=true
# Alias
alias cls="clear"
alias down="cd ~/Downloads"
alias ..="cd .."
alias ....="cd ../.."
alias look="sudo find . -name"
alias search="sudo grep --color -rnw ./ -e "
alias ports="sudo lsof -PiTCP -sTCP:LISTEN"
alias xclip="xclip -selection c"
alias speedtest="wget -O /dev/null cachefly.cachefly.net/100mb.test"
export LSCOLORS=""
export PROMPT_COMMAND="history -a; history -n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment