Skip to content

Instantly share code, notes, and snippets.

@ThisIsAreku
Last active October 2, 2019 09:54
Show Gist options
  • Save ThisIsAreku/f9a7936f7b32d20e78fde6f41aa84825 to your computer and use it in GitHub Desktop.
Save ThisIsAreku/f9a7936f7b32d20e78fde6f41aa84825 to your computer and use it in GitHub Desktop.
.env
# Source this file in your .zshrc BEFORE "source $ZSH/oh-my-zsh.sh"
export TERM="xterm-256color"
# Set your username here
export DEFAULT_USER=
# Digital Ocean Token
export DO_TOKEN=
# Path to Android SDK
export ANDROID_HOME="$HOME/Library/Android/sdk"
# Path to Glassfish
export GLASSFISH_HOME=
# Path to Gradle
export GRADLE_HOME="/usr/local/opt/gradle/libexec"
# Go path
export GOPATH="$HOME/go"
# Path to DevServices docker (https://gist.github.com/ThisIsAreku/3b10cac43cdf1ee639b91883ab02cc35)
export DEVSERVICES="$HOME/devservices"
export JAVA_HOME=`/usr/libexec/java_home`
# install theme here: https://github.com/bhilburn/powerlevel9k
# install powerline-patched fonts: https://github.com/powerline/fonts
export ZSH_THEME="spaceship"
export POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir virtualenv vcs)
export POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status history time)
export ZSH_AUTOSUGGEST_USE_ASYNC=true
export SPACESHIP_PROMPT_ORDER=(
time # Time stampts section
user # Username section
dir # Current directory section
host # Hostname section
git # Git section (git_branch + git_status)
# hg # Mercurial section (hg_branch + hg_status)
package # Package version
node # Node.js section
# ruby # Ruby section
# elixir # Elixir section
xcode # Xcode section
swift # Swift section
golang # Go section
php # PHP section
# rust # Rust section
# haskell # Haskell Stack section
# julia # Julia section
docker # Docker section
aws # Amazon Web Services section
venv # virtualenv section
# conda # conda virtualenv section
pyenv # Pyenv section
# dotnet # .NET section
# ember # Ember.js section
# kubecontext # Kubectl context section
exec_time # Execution time
line_sep # Line break
battery # Battery level and status
vi_mode # Vi-mode indicator
jobs # Background jobs indicator
exit_code # Exit code section
char # Prompt character
)
############################
### End of configuration ###
############################
export LANG=en_US.UTF-8
export EDITOR=vim
export COMPOSER_MEMORY_LIMIT=-1
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
export LESS="-R"
export PATH="/usr/local/sbin:$PATH"
if [ -d "$GOPATH" ]; then
export PATH=${PATH}:${GOPATH}/bin
fi
if [ -d "$HOME/.composer/vendor/bin" ]; then
export PATH=${PATH}:${HOME}/.composer/vendor/bin
fi
if [ -d "$GLASSFISH_HOME" ]; then
export PATH=${PATH}:${GLASSFISH_HOME}/bin
fi
if [ -d "$ANDROID_HOME" ]; then
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
function adbscreen() {
adb shell screencap -p /sdcard/screen.png
adb pull /sdcard/screen.png
adb shell rm /sdcard/screen.png
}
function logcat() {
PID=`adb shell ps | grep -i "$@" | cut -c10-15`;
adb logcat | grep $PID
}
function adb-all() {
adb devices | egrep '\t(device|emulator)' | cut -f 1 | xargs -t -J% -n1 -P5 adb -s % "$@"
}
function getapk() {
apk_path=$(adb -d shell pm path "$1"|cut -d':' -f2)
if [ -z "$apk_path" ]; then
echo 'No app'
return 1
fi
adb -d pull "${apk_path}" "${1}.apk"
}
fi
if [ -d "$DEVSERVICES" ]; then
function devsrv() {
if [ $# -lt 1 ]; then
(cd $DEVSERVICES && docker-compose)
return
fi
cmd=$1; shift;
case "$cmd" in
up)
(cd $DEVSERVICES && docker-compose up -d $@)
;;
*)
(cd $DEVSERVICES && docker-compose $cmd $@)
;;
esac
}
fi
# Java
function setjdk() {
if [ $# -ne 0 ]; then
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
if [ -n "${JAVA_HOME+x}" ]; then
removeFromPath $JAVA_HOME
fi
export JAVA_HOME=`/usr/libexec/java_home -v $@`
export PATH=$JAVA_HOME/bin:$PATH
fi
}
function removeFromPath() {
export PATH=$(echo $PATH | sed -E -e "s;:$1;;" -e "s;$1:?;;")
}
# SSH
#export SSH_KEY_PATH="~/.ssh/id_rsa"
function resetyubikey() {
killall -9 gpg-agent
# GPG Agent
gpg-launchagent;
}
function gpg-launchagent() {
gpgconf --launch gpg-agent
export GPG_TTY=$(tty)
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
}
gpg-launchagent;
# Allow to switch php version
function switch-php() {
if ! brew list "php@$1" >/dev/null 2>&1; then
printf 'Unknown php version: %s\n' $1 >&2
return 1
fi
# unloading all php versions
brew list | egrep 'php(?:\@[0-9]\.[0-9])?$' | xargs -n1 echo brew services stop | bash
brew list | egrep 'php(?:\@[0-9]\.[0-9])?$' | xargs -n1 echo brew unlink | bash
brew link "php@$1"
brew services start "php@$1"
}
# Git
#alias git='hub'
alias gs='git status'
alias gc='git commit'
alias gco='git checkout'
alias gh='git hist'
alias gl='git log'
alias gld='gl --decorate --all --oneline --graph'
alias gf='git fetch'
alias gfu='git fetch upstream'
alias gfo='git fetch origin'
alias gmum='git merge upstream/master'
alias gmom='git merge origin/master'
alias gp='git push'
alias gpum='git push upstream master'
alias gpom='git push origin master'
alias gb='git branch'
alias gba='git branch -a'
alias gbd='git branch -d'
alias gst='git stash'
# Useful
alias ls='ls -GFh'
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
# Symfony# Symfony
alias sf2='php app/console'
alias sf3='php bin/console'
alias sf='sf3'
alias flushdns='sudo killall -HUP mDNSResponder; sudo discoveryutil mdnsflushcache; sudo dscacheutil -flushcache'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment