Skip to content

Instantly share code, notes, and snippets.

@oshalygin
Created May 17, 2020 02:07
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 oshalygin/119ae9d78a537cf88ec902102477a887 to your computer and use it in GitHub Desktop.
Save oshalygin/119ae9d78a537cf88ec902102477a887 to your computer and use it in GitHub Desktop.
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# if [ "$TMUX" = "" ]; then tmux; fi
# source ~/.fonts/*.sh
export TERM="xterm-256color"
# Path to your oh-my-zsh installation.
export ZSH=/Users/oleqshalygin/.oh-my-zsh
# POWERLINE CONFIG
# POWERLEVEL9K_MODE='awesome-patched'
POWERLEVEL9K_MODE='nerdfont-complete'
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
POWERLEVEL9K_RPROMPT_ON_NEWLINE=true
#################################
zsh_internet_signal(){
#source on quality levels - http://www.wireless-nets.com/resources/tutorials/define_SNR_values.html
#source on signal levels - http://www.speedguide.net/faq/how-to-read-rssisignal-and-snrnoise-ratings-440
local signal=$(airport -I | grep agrCtlRSSI | awk '{print $2}' | sed 's/-//g')
local noise=$(airport -I | grep agrCtlNoise | awk '{print $2}' | sed 's/-//g')
local SNR=$(bc <<<"scale=2; $signal / $noise")
local net=$(curl -D- -o /dev/null -s http://www.google.com | grep HTTP/1.1 | awk '{print $2}')
local color='%F{yellow}'
local symbol="\uf197"
# Excellent Signal (5 bars)
if [[ ! -z "${signal// }" ]] && [[ $SNR -gt .40 ]] ;
then color='%F{blue}' ; symbol="\uf1eb" ;
fi
# Good Signal (3-4 bars)
if [[ ! -z "${signal// }" ]] && [[ ! $SNR -gt .40 ]] && [[ $SNR -gt .25 ]] ;
then color='%F{green}' ; symbol="\uf1eb" ;
fi
# Low Signal (2 bars)
if [[ ! -z "${signal// }" ]] && [[ ! $SNR -gt .25 ]] && [[ $SNR -gt .15 ]] ;
then color='%F{yellow}' ; symbol="\uf1eb" ;
fi
# Very Low Signal (1 bar)
if [[ ! -z "${signal// }" ]] && [[ ! $SNR -gt .15 ]] && [[ $SNR -gt .10 ]] ;
then color='%F{red}' ; symbol="\uf1eb" ;
fi
# No Signal - No Internet
if [[ ! -z "${signal// }" ]] && [[ ! $SNR -gt .10 ]] ;
then color='%F{red}' ; symbol="\uf011";
fi
if [[ -z "${signal// }" ]] && [[ "$net" -ne 200 ]] ;
then color='%F{red}' ; symbol="\uf011" ;
fi
# Ethernet Connection (no wifi, hardline)
if [[ -z "${signal// }" ]] && [[ "$net" -eq 200 ]] ;
then color='%F{blue}' ; symbol="\uf197" ;
fi
echo -n "%{$color%}$symbol " # \f1eb is wifi bars
}
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="%F{blue}\u256D\u2500%f"
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%F{blue}\u2570\uf460%f "
#################################
# POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir rbenv vcs)
# POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history time)
POWERLEVEL9K_CUSTOM_INTERNET_SIGNAL="zsh_internet_signal"
POWERLEVEL9K_CUSTOM_INTERNET_SIGNAL_BACKGROUND="black"
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status ram battery root_indicator)
# 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
ZSH_THEME="powerlevel9k/powerlevel9k"
# Set list of themes to load
# Setting this variable when ZSH_THEME=random
# cause zsh load theme from this variable instead of
# looking in ~/.oh-my-zsh/themes/
# An empty array 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 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.
plugins=(git node npm history docker osx git-open)
source $ZSH/oh-my-zsh.sh
export GOPATH="$HOME/go"
export PATH="$HOME/.yarn/bin:$PATH:$GOPATH/bin"
export PATH=$PATH:$HOME/maven/bin
export PATH=$PATH:$HOME/protoc/bin
export ARTIFACTORY_USER=atom.headless
export ARTIFACTORY_PASSWORD=orincon1
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home
export GO111MODULE=on
export GOPRIVATE=github.com/sadasystems/*
source $HOME/dev/zsh-git-prompt/zshrc.sh
export GIT_TERMINAL_PROMPT=1
# 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`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# MAVEN
# # Start TMUX if it isn't already started
# if [ "$TMUX" = "" ]; then tmux; fisource ~/powerlevel9k/powerlevel9k.zsh-theme
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
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/oleqshalygin/Downloads/google-cloud-sdk/path.zsh.inc' ]; then source '/Users/oleqshalygin/Downloads/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/oleqshalygin/Downloads/google-cloud-sdk/completion.zsh.inc' ]; then source '/Users/oleqshalygin/Downloads/google-cloud-sdk/completion.zsh.inc'; fi
# Init jenv
if which jenv > /dev/null; then eval "$(jenv init -)"; fi
source <(kubectl completion zsh)
autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C /usr/local/bin/terraform terraform
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment