Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.42 KB | None | 0 0
  1. # MACOS VS LINUX CONFIG
  2. if [[ $OSTYPE == *"darwin"* ]]; then
  3. echo LAUNCHED MACOS BASH PROFILE
  4. VS_CODE_PATH="/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
  5. else
  6. echo LAUNCHED LINUX BASH PROFILE
  7. VS_CODE_PATH="/home/$USER/tools/VSCode-linux-x64/bin"
  8. fi
  9.  
  10. #*********************************************************************************************************************************************
  11. # CONVENIENCE ALIASES
  12. #*********************************************************************************************************************************************
  13. alias code="'/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code' $1"
  14. alias sbp="source ~/.bash_profile"
  15. alias editBP="code ~/.bash_profile"
  16. alias diskSpace="df -h"
  17. alias paths="echo $PATH | tr : '\n' | sed 's/^/ /g'"
  18. alias grep_all_files="grep -rni $1 *"
  19. alias grep_all_ext_files="grep -rni --include=$1 $2"
  20. alias all_extensions="find . | sed s#.*/##g | grep [.] | sed \"s/.*\.//g\" | sort | uniq"
  21.  
  22.  
  23. #*********************************************************************************************************************************************
  24. # PYTHON STUFF
  25. #*********************************************************************************************************************************************
  26. alias listReqs="grep -R --no-filename --include=requirements.txt [a-z] . | sort | uniq | grep -v \#"
  27. alias allReqs="echo pip install `listReqs | tr '\n' ' '`"
  28. alias edpacks="find $SITE_PACKS -name '*.egg-link' | sed 's/^/ /g'"
  29.  
  30.  
  31. #*********************************************************************************************************************************************
  32. # GIT STUFF
  33. #*********************************************************************************************************************************************
  34. COMMIT_FILE=~/git_commit_message.txt
  35. alias editGM='code $COMMIT_FILE'
  36. alias gitCM='git commit -F $COMMIT_FILE'
  37. alias gitU='git pull origin master'
  38. alias gitPOM='git push origin master'
  39. alias logtop='git log -n 1'
  40. alias gl1='logtop'
  41. alias lastmsg='logtop | sed 1,4d | sed "s/^ //g"'
  42. alias switchGM='lastmsg > $COMMIT_FILE'
  43. alias gitBranches='git branch | sed "s/^. //g"'
  44. alias cfs='git status --porcelain | sed "s#^.*/#* #g">> $COMMIT_FILE'
  45. alias filediff='git diff $1 $2 -- $3'
  46. alias all_authors='git log --pretty=format:"%an%x09" $1 | sort | uniq'
  47.  
  48.  
  49. #*********************************************************************************************************************************************
  50. # CPP STUFF
  51. #*********************************************************************************************************************************************
  52. CPP_SOURCE="--include=*.cpp --include=*.h --include=*.c"
  53. CPP_EXCLUDE="(third_party)"
  54. COND_COMP_PATTERN="^ *# *(el)?if"
  55. COND_COMP_CLEAN1="s/.*://g; s/[!()]/ /g; s/ +/ /g"
  56. COND_COMP_CLEAN2="s%(#ifn?def|#if|#elif|#endif|defined|/\*.*\*/|//.*)%%g"
  57. IGNORE_MACROS="^(true|false|[0-9]+[UL]*)$"
  58. alias macro_hits="grep $CPP_SOURCE -rE \"$COND_COMP_PATTERN\" . | grep -vE \"$CPP_EXCLUDE\""
  59. alias all_macros="macro_hits | sed -E \"$COND_COMP_CLEAN1\" | tr '|&%*/<>=' '\n' | sed -E \"$COND_COMP_CLEAN2\" | grep . | tr -d ' ' | sort | uniq"
  60. alias proto_hits="grep --include=*.proto -rE \"syntax +=\" . | tr \' '\"'"
  61. alias proto_syntax="proto_hits | sed \"s#.*syntax##g\" | tr -d ' ;\"=' | sort | uniq"
  62.  
  63. macro_users() {
  64. filename='all_macros.txt'
  65. all_macros | grep -vE "$IGNORE_MACROS" > $filename
  66.  
  67. while read p; do
  68. echo -e "\n=================================================================================================================================================="
  69. echo MACRO: $p
  70. grep $CPP_SOURCE -rFl $p . | grep -vE "$CPP_EXCLUDE"
  71. done < $filename
  72. }
  73.  
  74.  
  75.  
  76. #*********************************************************************************************************************************************
  77. # Input RC Settings
  78. #*********************************************************************************************************************************************
  79. if [ ! -f "$HOME/.inputrc" ]; then
  80. echo Generating inputrc file...
  81. echo "# ↑" > ~/.inputrc
  82. echo "\"\\e[A\":history-search-backward" >> ~/.inputrc
  83. echo "# ↓" >> ~/.inputrc
  84. echo "\"\\e[B\":history-search-forward" >> ~/.inputrc
  85.  
  86. echo "# Try to stay at the same the cursor position when moving through the history." >> ~/.inputrc
  87. echo "set history-preserve-point on" >> ~/.inputrc
  88. bind -f ~/.inputrc
  89. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement