Skip to content

Instantly share code, notes, and snippets.

@lucianomlima
Created December 6, 2018 20:23
Show Gist options
  • Save lucianomlima/8958d64dcd524cadbc976919ad670c26 to your computer and use it in GitHub Desktop.
Save lucianomlima/8958d64dcd524cadbc976919ad670c26 to your computer and use it in GitHub Desktop.
ZShell Config
# 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
ZSH_THEME="bullet-train"
# 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=15
# 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=(
docker-compose history iterm2 kubectl minikube node npm osx react-native yarn zsh-autosuggestions zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
# User configuration
BULLETTRAIN_PROMPT_ORDER=(
custom
context
dir
git
cmd_exec_time
)
BULLETTRAIN_GIT_DIRTY=" %F{red}✘%F{green}"
BULLETTRAIN_GIT_CLEAN=" ✔"
BULLETTRAIN_GIT_ADDED=" ✚"
BULLETTRAIN_GIT_MODIFIED=" %F{blue}✹%F{green}"
BULLETTRAIN_GIT_DELETED=" %F{red}✖%F{green}"
BULLETTRAIN_GIT_UNTRACKED=" %F{yellow}✭%F{green}"
BULLETTRAIN_GIT_FG=green
BULLETTRAIN_CONTEXT_FG=cyan
BULLETTRAIN_EXEC_TIME_BG=cyan
BULLETTRAIN_EXEC_TIME_FG=white
BULLETTRAIN_KCTX_KCONFIG=$HOME/.kube/config
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
export LANG=pt_BR.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"
alias ga='git add'
alias gb='git branch'
alias gc='git commit'
alias gd='git diff'
alias gl='git log'
alias go='git checkout'
alias gr='git remote -v'
alias gs='git status'
alias push='git push'
alias pull='git pull'
alias targz='tar -czf'
alias tarbz='tar -cjf'
alias untargz='tar -xvzf'
alias untarbz='tar -xvjf'
alias menu='adb shell input keyevent 82'
alias cleanDSStores='find . -name ".DS_Store" -type f -delete'
alias briefdiff='colordiff -Bwrq'
alias diff='colordiff -Bwr'
eval "$(rbenv init -)"
# Custom Functions
function android_key_hash {
if [[ -z $1 && -z $2 ]]; then
echo "Android Key Hash sintax:"
echo "android_key_hash alias path/to/filename.keystore"
return
fi
keytool -exportcert -alias $1 -keystore $2 | openssl sha1 -binary | openssl base64
}
function android_keystore {
if [[ -z $1 ]]; then
echo "Generate android keystore file sintax:"
echo "android_keystore app_name"
return
fi
keytool -genkey -v -keystore $1.keystore -alias $1 -keyalg RSA -keysize 2048 -validity 10000
}
function keystore_alias {
if [[ -z $1 ]]; then
echo "Check android keystore alias sintax:"
echo "keystore_alias path/to/filename.keystore"
return
fi
keytool -v -list -keystore "$1" | grep "alias"
}
function android_screenshot {
FILENAME=`date +%Y%m%d%H%M%S`;
adb shell /system/bin/screencap -p /sdcard/$FILENAME.png;
adb pull /sdcard/$FILENAME.png ~/Desktop/$FILENAME.png;
}
function icon_generator {
if [[ -z $1 && -z $2 ]]; then
echo "Icon Generator sintax:"
echo "icon_generator icon.png ../path/to/export"
return
fi
ticons icons -p ios,android -d $2 $1
}
function splash_generator {
if [[ -z $1 && -z $2 ]]; then
echo "SplashScreen Generator sintax:"
echo "splash_generator splashscreen.png ../path/to/export"
return
fi
ticons splashes -n -p ios,android -d $2 $1
}
function mov2gif {
PALETTE=/tmp/palette.png
ffmpeg -i $1 -y -vf palettegen $PALETTE
ffmpeg -i $1 -i $PALETTE -lavfi paletteuse=bayer_scale=5:dither=bayer -r 10 -f gif -y $2
rm $PALETTE
}
function mov2mp4 {
ffmpeg -i $1 -vcode h264 -acodec acc -strict -2 $2
}
function k8s_change_ctx {
if command -v kubectl > /dev/null 2>&1; then
CONTEXT=`kubectl config get-contexts | grep -v -e '*' | sed -n '1!p' | awk '{print $2}'`
kubectl config use-context $CONTEXT
fi
}
# Android SDK
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools
# NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment