Browse Source

Various improvements

R. Alex Matevish 4 years ago
parent
commit
7997cc8e78
5 changed files with 61 additions and 7 deletions
  1. 32 1
      airbnb.sh
  2. 20 3
      git.sh
  3. 2 2
      install.sh
  4. 2 0
      mac.sh
  5. 5 1
      main.sh

+ 32 - 1
airbnb.sh

@@ -3,11 +3,16 @@ export EMPLOYEE_ID=109479
 alias aid="echo $AIRBNB_ID && echo -n $AIRBNB_ID | pbcopy"
 alias eid="echo $EMPLOYEE_ID && echo -n $EMPLOYEE_ID | pbcopy"
 
-alias th="cd ~/airlab/repos/treehouse"
+alias ab="cd ~/airlab/repos/airbnb"
 alias alr="cd ~/airlab/repos"
+
+# Treehouse
+alias th="cd ~/airlab/repos/treehouse"
 alias sonic="cd ~/airlab/repos/treehouse/projects/sonic"
 alias dolores="cd ~/airlab/repos/treehouse/projects/trips/dolores"
 alias kelku="cd ~/airlab/repos/treehouse/projects/kelku"
+alias viaduct="cd ~/airlab/repos/treehouse/projects/viaduct"
+
 alias oyster="cd ~/airlab/repos/oyster-schema"
 
 export CDPATH=.\
@@ -22,6 +27,10 @@ export AFDEV_HOST="i-08912b2bb5b7d7634.inst.aws.airbnb.com"
 export AFDEV_PORT=61883
 export AFDEV_USER="$USER"
 
+# Aliases
+alias al=airlab
+alias ykk="airlab rekey 2>&/dev/null"
+
 # Shortcuts for setting env var
 alias dev="ENV=development"
 alias canary="ENV=canary"
@@ -54,3 +63,25 @@ function unfuck-git {
 
 export K2=y
 alias start_swagger="docker pull swaggerapi/swagger-editor && docker run -d -p 80:8080 swaggerapi/swagger-editor"
+
+function find_parent_gradle_project {
+    if [[ -z "$1" ]]
+    then
+        FILE_PATH=`pwd`
+    else
+        FILE_PATH="$1"
+    fi
+
+    while [[ $FILE_PATH != / ]];
+    do
+        GRADLE_DIR=`find "$FILE_PATH" -maxdepth 1 -mindepth 1 -type f -name 'build.gradle'`
+        if [ -z "$GRADLE_DIR" ]
+        then
+            FILE_PATH="$(realpath -s "$FILE_PATH"/..)"  # ignore symlinks
+        else
+            break
+        fi
+    done
+    echo `dirname $GRADLE_DIR`
+}
+

+ 20 - 3
git.sh

@@ -5,19 +5,36 @@
 ##############################################################################
 if command_exists git; then
 
+    git config --global alias.a add
+    git config --global alias.b branch
+    git config --global alias.c checkout
+    git config --global alias.co commit
+    git config --global alias.d difftool
+    git config --global alias.f fetch
+    git config --global alias.l log
+    git config --global alias.ps push
+    git config --global alias.s status
+    git config --global alias.st stash
+
+    git config --global alias.bn "rev-parse --abbrev-ref HEAD"  # branch-name
+    git config --global alias.psc "push origin \`git rev-parse --abbrev-ref HEAD\`"  # push current
+    git config --global alias.plc "pull origin \`git rev-parse --abbrev-ref HEAD\`"  # pull current
+    git config --global alias.lco "log -n 1 --pretty=format:'%h'"
+    git config --global alias.bp "merge-base --octopus master"
+
     alias gs='git status'
     alias ga='git add'
     alias gc='git checkout'
     alias gco='git commit'
     alias gd='git difftool'
     alias gb='git branch'
+    alias gbn='git rev-parse --abbrev-ref HEAD'
     alias gps='git push origin `git rev-parse --abbrev-ref HEAD`'
     alias gpl='git pull origin `git rev-parse --abbrev-ref HEAD`'
     alias gp='git pull origin `git rev-parse --abbrev-ref HEAD`'
     alias gst='git stash'
     alias gf='git fetch'
-    alias gpgf='git pull && git gf'
-    alias lco='git log -n 1 --pretty=format:"%H"'
+    alias gdm='git diff `git bp`...HEAD'
 
     function git-delete-merged () {
         n=$'\n'
@@ -44,5 +61,5 @@ if command_exists git; then
 
         fi
     }
-
 fi
+

+ 2 - 2
install.sh

@@ -14,8 +14,8 @@ fi
 echo ""
 
 # Shortcuts to edit configs
-echo "alias edit_configs='vi ${CONFIG_INSTALL_DIR}'" >> $CONFIG_OUTPUT_FILE
-echo "alias update_configs='(cd ${CONFIG_INSTALL_DIR} && ./install.sh) && echo \"Loading ${CONFIG_INSTALL_DIR}/${CONFIG_OUTPUT_FILE}\" && source ${CONFIG_INSTALL_DIR}/${CONFIG_OUTPUT_FILE}'" >> $CONFIG_OUTPUT_FILE
+echo "alias ec='vi ${CONFIG_INSTALL_DIR}'" >> $CONFIG_OUTPUT_FILE
+echo "alias uc='(cd ${CONFIG_INSTALL_DIR} && ./install.sh) && echo \"Loading ${CONFIG_INSTALL_DIR}/${CONFIG_OUTPUT_FILE}\" && source ${CONFIG_INSTALL_DIR}/${CONFIG_OUTPUT_FILE}'" >> $CONFIG_OUTPUT_FILE
 echo "alias cd_configs='cd ${CONFIG_INSTALL_DIR}'" >> $CONFIG_OUTPUT_FILE
 
 # Check all scripts have valid syntax before wiping out the old script

+ 2 - 0
mac.sh

@@ -4,6 +4,8 @@
 #
 ##############################################################################
 
+alias cb='pbcopy'
+
 if file_exists "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"; then
     function subl() {
         /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl ${1:-.}

+ 5 - 1
main.sh

@@ -19,12 +19,16 @@ alias awk1="awk '{print \$1}'"
 alias awk2="awk '{print \$2}'"
 alias awk3="awk '{print \$3}'"
 alias awklast="rev | awk1 | rev"
-
+alias fthr="numfmt --to=iec-i --suffix=B --padding=7"
 
 function killit {
     ps aux | grep -i "$1" | grep -v "grep" | awk2 | xargs kill ${@:2:99}
 }
 
+function largefiles() {
+    du -k $1  2>/dev/null | awk '$1 > 1000000' | sort -nr | awk -F' ' '{ print system("numfmt --to=iec-i --suffix=B -z --padding=7 " $1 * 1000) " " $2 }'
+}
+
 export ROME=$PATH:$PYTHONPATH:$CLASSPATH:$ORACLEPATH:$FOOPATH:$LOLPATH:$YOLOPATH:$(which python)
 
 function gpid() {