Skip to content

Instantly share code, notes, and snippets.

@michaelmano
Last active January 23, 2019 23:11
Show Gist options
  • Save michaelmano/a49483c9f0501d6596c92e6151f2d422 to your computer and use it in GitHub Desktop.
Save michaelmano/a49483c9f0501d6596c92e6151f2d422 to your computer and use it in GitHub Desktop.
Bash Profile
# Exports
## Development Paths
export DEV_DIR="${HOME}/Development"
export SCRIPTS_DIR="${DEV_DIR}/Scripts"
export TOOLS_DIR="${DEV_DIR}/Tools"
## Load all scripts from the SCRIPTS_DIR
for script in $SCRIPTS_DIR/*; do . $script; done
## Set the operating system type into a variable
export OS="$(detect_os_and_set_var)"
## PS1 Prompt
export PS1="\u@\h ${color_cyan}[\w] ${color_yellow}\$(git_branch)\n${color_green}|>${color_off} "
## Mobile Develeopment
export JAVA_HOME=$(/usr/libexec/java_home)
export ANDROID_HOME=$HOME/Library/Android/sdk
export ANDROID_SDK_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$HOME/.fastlane/bin
export PATH=$PATH:$ANDROID_SDK_HOME/tools:$ANDROID_SDK_HOME/platform-tools
## Node Version Manager,
export NVM_DIR="$HOME/.nvm"
. "$NVM_DIR/nvm.sh"
## Composer
export PATH=$PATH:$HOME/.composer/vendor/bin
export PATH=$PATH:./vendor/bin
# Aliases
## Change Directory
alias cdd="cd ${DEV_DIR}"
alias cdp="cd ${PROD_DIR}"
alias cdl="cd ${DEV_DIR}/Laravel"
alias cdwp="cd ${DEV_DIR}/Wordpress"
alias cds="cd ${SCRIPTS_DIR}"
## PHP
alias part="php artisan"
alias dbsr="php ${TOOLS_DIR}/db-search-replace/srdb.cli.php"
## GIT
alias nah="git reset --hard && git clean -f -d"
alias stree='/Applications/SourceTree.app/Contents/Resources/stree'
## Android Studio
alias emulator="$ANDROID_SDK_HOME/tools/emulator ${@}"
alias emu="emulator @$(emulator -list-avds | head -1) &>/dev/null &"
## Tree
alias tree="tree ${@} --charset unicode"
alias brewski="brew update && brew upgrade && brew cleanup; brew doctor"
#!/bin/bash
# Located in ~/Development/Scripts/
init()
{
# turn off all colors
color_off="\[\033[0m\]"
# regular colors
color_black="\[\033[30m\]"
color_red="\[\033[31m\]"
color_green="\[\033[32m\]"
color_yellow="\[\033[33m\]"
color_blue="\[\033[34m\]"
color_cyan="\[\033[36m\]"
color_white="\[\033[37m\]"
color_purple="\[\033[35m\]"
# bold
color_b_black="\[\033[30m\]"
color_b_red="\[\033[31m\]"
color_b_green="\[\033[32m\]"
color_b_yellow="\[\033[33m\]"
color_b_blue="\[\033[34m\]"
color_b_purple="\[\033[35m\]"
color_b_cyan="\[\033[36m\]"
color_b_white="\[\033[37m\]"
# underline
color_u_black="\[\033[30m\]"
color_u_red="\[\033[31m\]"
color_u_green="\[\033[32m\]"
color_u_yellow="\[\033[33m\]"
color_u_blue="\[\033[34m\]"
color_u_purple="\[\033[35m\]"
color_u_cyan="\[\033[36m\]"
color_u_white="\[\033[37m\]"
# background
color_bg_black="\[\033[40m\]"
color_bg_red="\[\033[41m\]"
color_bg_green="\[\033[42m\]"
color_bg_yellow="\[\033[43m\]"
color_bg_blue="\[\033[44m\]"
color_bg_purple="\[\033[45m\]"
color_bg_cyan="\[\033[46m\]"
color_bg_white="\[\033[47m\]"
}
init
#!/bin/bash
# Located in ~/Development/Scripts/
detect_os_and_set_var()
{
case $OSTYPE in
linux*) echo linux;;
darwin*) echo mac;;
msys*) echo windows;;
solaris*) echo solaris;;
bsd*) echo bsd;;
*) echo unknown;;
esac
}
#!/bin/bash
# Located in ~/Development/Scripts/
git_branch()
{
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment