Last active
November 12, 2017 00:25
-
-
Save Jman/7419074 to your computer and use it in GitHub Desktop.
my bash profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export TERM=xterm-256color | |
export CLICOLOR=1 | |
export EDITOR="/usr/local/bin/mate -w" | |
export LC_ALL=ru_RU.UTF-8 | |
if [ -f "/Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash" ] | |
then | |
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash | |
fi | |
if [ -f "/Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh" ] | |
then | |
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh | |
fi | |
if ps $PPID | grep mc; then | |
export PS1="\u@\h:\w$" | |
export PROMPT_COMMAND="" | |
else | |
function _update_ps1() { | |
export PS1="$(~/Dropbox/sync-config/powerline-shell/powerline-shell.py $? 2> /dev/null)" | |
} | |
export PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" | |
fi | |
# export PS1="\n\[\e[1;36m\][\t]\[\e[0m\] \[\e[01;32m\]\u@\h\[\e[0m\]: \[\e[1;34m\]\w\[\e[0m\] \[\e[1;32m\]\$(__git_ps1 '%s')\[\e[0m\] \n→ " | |
# history | |
export HISTCONTROL=ignoredup # don't put duplicate lines in the history.s | |
export HISTFILESIZE=3000 | |
export HISTIGNORE="ls:la:cd:reloadbash:exit:..:..." | |
shopt -s histappend # Append to the Bash history file, rather than overwriting it | |
# autofix typos | |
shopt -s cdspell | |
# aliases | |
alias ls='ls -G' # OS-X SPECIFIC - the -G command in OS-X is for colors, in Linux it's no groups | |
alias la='ls -AGHhle' | |
alias ..='cd ..' | |
alias ...='cd ../..' | |
alias psg='ps aux | egrep -i --color' | |
alias reloadbash='source ~/.profile' | |
# Empty the Trash on all mounted volumes and the main HDD | |
# Also, clear Apple’s System Logs to improve shell startup speed | |
alias emptytrash='sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl' | |
# Clear "Open With ..." context menu | |
alias fixow='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user;killall Finder;echo "Open With has been rebuilt, Finder will relaunch"' | |
alias google-chrome='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome' | |
alias lockscreen='/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend' | |
alias mc='mc -S xoria256' | |
search() { | |
find / -name $@ 2>/dev/null | |
} | |
# On Mac OS X, SSH to another Mac by hostname via Back To My Mac (iCloud) | |
# The client and target machines must both have Back To My Mac enabled | |
# Adapted from code found at <http://onethingwell.org/post/27835796928/remote-ssh-bact-to-my-mac> | |
sshicloud() { | |
if [[ $# -eq 0 || $# -gt 2 ]]; then | |
echo "Usage: $0 computername [username]" | |
elif ! hash "scutil" &> /dev/null; then | |
echo "$0 only works on Mac OS X! Aborting." | |
else | |
local _icloud_addr=`echo show Setup:/Network/BackToMyMac | scutil | sed -n 's/.* : *\(.*\).$/\1/p'` | |
local _username=`whoami` | |
if [[ $# -eq 2 ]]; then | |
_username=$2 | |
fi | |
ssh $_username@$1.$_icloud_addr | |
fi | |
} | |
# acl permissions | |
# http://symfony.com/doc/current/setup/file_permissions.html#using-acl-on-a-system-that-supports-chmod-a-macos | |
acl() { | |
local _username=`whoami` | |
local _http_user=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1` | |
sudo chmod -R +a "$_http_user allow delete,write,append,file_inherit,directory_inherit" $@ | |
sudo chmod -R +a "$_username allow delete,write,append,file_inherit,directory_inherit" $@ | |
} | |
# completion after sudo | |
complete -cf sudo | |
# android | |
export PATH=~/Library/Android/sdk/platform-tools:~/Library/Android/sdk/platforms:~/Library/Android/sdk/tools:$PATH | |
# python | |
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH | |
export WORKON_HOME=~/.virtualenvs | |
source /usr/local/bin/virtualenvwrapper.sh | |
#homebrew | |
export PATH=/usr/local/bin:$PATH | |
export PATH=/usr/local/sbin:$PATH | |
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion | |
ORO_PHP_PATH=/usr/local/bin/php | |
### Added by the Heroku Toolbelt | |
export PATH="/usr/local/heroku/bin:$PATH" | |
export PATH="$PATH:`yarn global bin`" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment