Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # MACOS VS LINUX CONFIG
- if [[ $OSTYPE == *"darwin"* ]]; then
- echo LAUNCHED MACOS BASH PROFILE
- VS_CODE_PATH="/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
- else
- echo LAUNCHED LINUX BASH PROFILE
- VS_CODE_PATH="/home/$USER/tools/VSCode-linux-x64/bin"
- fi
- #*********************************************************************************************************************************************
- # CONVENIENCE ALIASES
- #*********************************************************************************************************************************************
- alias code="'/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code' $1"
- alias sbp="source ~/.bash_profile"
- alias editBP="code ~/.bash_profile"
- alias diskSpace="df -h"
- alias paths="echo $PATH | tr : '\n' | sed 's/^/ /g'"
- alias grep_all_files="grep -rni $1 *"
- alias grep_all_ext_files="grep -rni --include=$1 $2"
- alias all_extensions="find . | sed s#.*/##g | grep [.] | sed \"s/.*\.//g\" | sort | uniq"
- #*********************************************************************************************************************************************
- # PYTHON STUFF
- #*********************************************************************************************************************************************
- alias listReqs="grep -R --no-filename --include=requirements.txt [a-z] . | sort | uniq | grep -v \#"
- alias allReqs="echo pip install `listReqs | tr '\n' ' '`"
- alias edpacks="find $SITE_PACKS -name '*.egg-link' | sed 's/^/ /g'"
- #*********************************************************************************************************************************************
- # GIT STUFF
- #*********************************************************************************************************************************************
- COMMIT_FILE=~/git_commit_message.txt
- alias editGM='code $COMMIT_FILE'
- alias gitCM='git commit -F $COMMIT_FILE'
- alias gitU='git pull origin master'
- alias gitPOM='git push origin master'
- alias logtop='git log -n 1'
- alias gl1='logtop'
- alias lastmsg='logtop | sed 1,4d | sed "s/^ //g"'
- alias switchGM='lastmsg > $COMMIT_FILE'
- alias gitBranches='git branch | sed "s/^. //g"'
- alias cfs='git status --porcelain | sed "s#^.*/#* #g">> $COMMIT_FILE'
- alias filediff='git diff $1 $2 -- $3'
- alias all_authors='git log --pretty=format:"%an%x09" $1 | sort | uniq'
- #*********************************************************************************************************************************************
- # CPP STUFF
- #*********************************************************************************************************************************************
- CPP_SOURCE="--include=*.cpp --include=*.h --include=*.c"
- CPP_EXCLUDE="(third_party)"
- COND_COMP_PATTERN="^ *# *(el)?if"
- COND_COMP_CLEAN1="s/.*://g; s/[!()]/ /g; s/ +/ /g"
- COND_COMP_CLEAN2="s%(#ifn?def|#if|#elif|#endif|defined|/\*.*\*/|//.*)%%g"
- IGNORE_MACROS="^(true|false|[0-9]+[UL]*)$"
- alias macro_hits="grep $CPP_SOURCE -rE \"$COND_COMP_PATTERN\" . | grep -vE \"$CPP_EXCLUDE\""
- alias all_macros="macro_hits | sed -E \"$COND_COMP_CLEAN1\" | tr '|&%*/<>=' '\n' | sed -E \"$COND_COMP_CLEAN2\" | grep . | tr -d ' ' | sort | uniq"
- alias proto_hits="grep --include=*.proto -rE \"syntax +=\" . | tr \' '\"'"
- alias proto_syntax="proto_hits | sed \"s#.*syntax##g\" | tr -d ' ;\"=' | sort | uniq"
- macro_users() {
- filename='all_macros.txt'
- all_macros | grep -vE "$IGNORE_MACROS" > $filename
- while read p; do
- echo -e "\n=================================================================================================================================================="
- echo MACRO: $p
- grep $CPP_SOURCE -rFl $p . | grep -vE "$CPP_EXCLUDE"
- done < $filename
- }
- #*********************************************************************************************************************************************
- # Input RC Settings
- #*********************************************************************************************************************************************
- if [ ! -f "$HOME/.inputrc" ]; then
- echo Generating inputrc file...
- echo "# ↑" > ~/.inputrc
- echo "\"\\e[A\":history-search-backward" >> ~/.inputrc
- echo "# ↓" >> ~/.inputrc
- echo "\"\\e[B\":history-search-forward" >> ~/.inputrc
- echo "# Try to stay at the same the cursor position when moving through the history." >> ~/.inputrc
- echo "set history-preserve-point on" >> ~/.inputrc
- bind -f ~/.inputrc
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement