Skip to content

Instantly share code, notes, and snippets.

@jonohayon
Created May 20, 2016 18:08
Show Gist options
  • Save jonohayon/11dfaa9de14fd08d2eb450919b206d5f to your computer and use it in GitHub Desktop.
Save jonohayon/11dfaa9de14fd08d2eb450919b206d5f to your computer and use it in GitHub Desktop.
.bash_profile
# Determine if a directory is a Git repository too
function is_git {
git branch >/dev/null 2>/dev/null && echo 'true' && return
echo 'false'
}
# Git info for prompt
function git_info {
isGit=$(is_git)
case $isGit in
"true" )
branchName=$(git rev-parse --abbrev-ref HEAD)
echo "git($branchName)"
;;
"false" )
echo ""
;;
esac
}
# Prompt thingy
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
function prompt {
local BLACK="\[\033[0;30m\]"
local BLACKBOLD="\[\033[1;30m\]"
local RED="\[\033[0;31m\]"
local REDBOLD="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local GREENBOLD="\[\033[1;32m\]"
local YELLOW="\[\033[0;33m\]"
local YELLOWBOLD="\[\033[1;33m\]"
local BLUE="\[\033[0;34m\]"
local BLUEBOLD="\[\033[1;34m\]"
local PURPLE="\[\033[0;35m\]"
local PURPLEBOLD="\[\033[1;35m\]"
local CYAN="\[\033[0;36m\]"
local CYANBOLD="\[\033[1;36m\]"
local WHITE="\[\033[0;37m\]"
local WHITEBOLD="\[\033[1;37m\]"
local MAGENTA="\[\033[0;35m\]"
local MAGENTABOLD="\[\033[1;35m\]"
local RESETCOLOR="\[\e[00m\]"
export PS1="$GREENBOLD\A $YELLOWBOLD\u $REDBOLD@ $CYANBOLD\w $MAGENTABOLD\$(git_info)\n $BLUEBOLD → $REDBOLD"
export PS2="| → $REDBOLD"
}
prompt
# Setting JAVA_HOME, ANDROID_HOME and PATH
export JAVA_HOME="/usr/lib/jvm/java-8-oracle/"
export ANDROID_HOME="/home/rezozo/Android/Sdk"
export STUDIO_HOME="~/android-studio"
export ANDROID_EMULATOR_FORCE_32BIT="true"
export PATH="$ANDROID_HOME/tools:$PATH"
export PATH="$ANDROID_HOME/platform-tools:$PATH"
export PATH="$STUDIO_HOME/bin:$PATH"
# PhantomJS
export PHANTOM_HOME="~/phantomjs-2.1.1-linux-i686/"
export PATH="$PHANTOM_HOME/bin:$PATH"
# apktool
export APKTOOL_HOME="~/apktool"
export PATH="$APKTOOL_HOME:$PATH"
# jadx
export JADX_HOME="~/jadx/bin/"
export PATH="$JADX_HOME:$PATH"
# dex2jar
export D2J_HOME="~/dex2jar"
export PATH="$D2J_HOME:$PATH"
# jd-ui
export JDUI_HOME="~/jd-ui"
export PATH="$JDUI_HOME:$PATH"
# NW.js
export NWJS_HOME="~/nwjs"
export PATH="$NWJS_HOME:$PATH"
# Popcorn Time
export POPCORN_HOME="~/popcorn"
export PATH="$POPCORN_HOME:$PATH"
# WebTorrent Desktop
export WEBTORRENT_HOME="~/webtorrent"
export PATH="$WEBTORRENT_HOME:$PATH"
# Swift
export SWIFT_HOME="~/swift/usr/bin"
export PATH="$SWIFT_HOME:$PATH"
# Telegram
export TELEGRAM_HOME="~/telegram/Telegram"
export PATH="$TELEGRAM_HOME:$PATH"
# Prepros
export PREPROS_HOME="~/prepros"
export PATH="$PREPROS_HOME:$PATH"
# Electron
export ELECTRON_LINUX_HOME="~/electron"
export PATH="$ELECTRON_LINUX_HOME:$PATH"
###################
# Custom commands #
###################
alias pdir="cd ~/Desktop/Projects" # cd to projects directory
alias nindex="node index.js" # run index.js using nodejs
alias smocha="sudo mocha" # run mocha tests (nodejs)
alias snpm="sudo npm"
alias nnftp=". ~/nnftp.sh"
alias telegram="nohup $TELEGRAM_HOME/Telegram &"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment