Skip to content

Instantly share code, notes, and snippets.

@azam
Last active January 29, 2016 03:18

Revisions

  1. azam revised this gist Jan 29, 2016. 1 changed file with 8 additions and 18 deletions.
    26 changes: 8 additions & 18 deletions .profile
    Original file line number Diff line number Diff line change
    @@ -46,10 +46,10 @@ gitprep() {
    cd $1
    git init
    git config user.name "azam"
    git config user.email "[email protected]"
    git config user.email "[email protected]"
    git config push.default simple
    git config core.precomposeunicode true
    git remote add origin git@github-azam:$2
    git remote add origin git@github.com:$2
    git remote update
    return 0
    fi
    @@ -62,23 +62,13 @@ randpass() {
    }

    run() {
    echo "$@"
    local n=$1
    shift
    # local c=$()
    # local q="'"
    # local qq='"'
    # for s in "$@"; do
    # c+=("${s//$q/$q$qq$q$qq$q}")
    # done
    # echo "${c[*]}"
    echo "$@"
    for i in `seq $n`; do
    # echo "${c[*]}" >> nohup.out.$i
    nohup $@ &> nohup.out.$i &
    done
    local n=$1
    shift
    for i in `seq $n`; do
    nohup $@ &> nohup.out.$i &
    done
    }

    zipall() {
    for i in */; do zip -r "${i%/}.zip" "$i"; done
    for i in */; do zip -r "${i%/}.zip" "$i"; done
    }
  2. azam created this gist Jan 29, 2016.
    84 changes: 84 additions & 0 deletions .profile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,84 @@
    ### Java
    export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)

    ### Maven
    export MAVEN_HOME="$HOME/Applications/apache-maven-3.3.3"
    export M3=$MAVEN_HOME
    export M3_HOME=$M3
    export PATH=$PATH:$M3_HOME/bin

    ### Android
    export ANDROID_HOME="$HOME/Applications/android-sdk-macosx"
    export ADT_HOME=$ANDROID_HOME
    export ANDROID_TOOLS="$ANDROID_HOME/tools"
    export ANDROID_PLATFORM_TOOLS="$ANDROID_HOME/platform-tools"
    export PATH=$PATH:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS

    ### NPM
    export PATH=$PATH:./node_modules/.bin

    ### Azam
    alias ll='ls -alG'
    alias flushdns='sudo killall -HUP mDNSResponder'
    export PS1="\D{%T} \W$ "
    alias servehere="python -c 'import BaseHTTPServer as bhs, SimpleHTTPServer as shs; bhs.HTTPServer((\"0.0.0.0\", 8888), shs.SimpleHTTPRequestHandler).serve_forever()'"
    alias gitlinestats="git log --pretty=format:%an | awk '{ ++c[$0]; } END { for(cc in c) printf \"%5d %s\\n\",c[cc],cc; }' | sort -rn"
    #alias gitblamestats="export LC_ALL=C;git ls-tree -r HEAD|gsed -re 's/^.{53}//'|while read filename; do file \"$filename\"; done|grep -E ': .*text'|gsed -r -e 's/: .*//'|while read filename; do git blame -w \"$filename\"; done|gsed -r -e 's/.*\((.*)[0-9]{4}-[0-9]{2}-[0-9]{2} .*/\1/' -e 's/ +$//'|sort|uniq -c;export LC_ALL"
    #alias gitblamestats="git ls-tree -r HEAD"
    alias mroe=more
    alias chromedev="open /Applications/Google\ Chrome.app --args --disable-web-security"
    alias st="open -a /Applications/Sublime\ Text.app $1"

    gitstats() {
    export LC_ALL=C
    git ls-tree -r HEAD | gsed -re 's/^.{53}//' | while read filename; do file "$filename"; done | grep -E ': .*text' | gsed -r -e 's/: .*//' | while read filename; do git blame -w "$filename"; done | gsed -r -e 's/.*\((.*)[0-9]{4}-[0-9]{2}-[0-9]{2} .*/\1/' -e 's/ +$//' | sort | uniq -c
    export LC_ALL=
    }

    gitprep() {
    if [ -z "$2" ]
    then
    echo "gitprep: illegal arguments"
    echo "usage: gitprep [dirname] [reponame]"
    return -1
    else
    mkdir $1
    cd $1
    git init
    git config user.name "azam"
    git config user.email "[email protected]"
    git config push.default simple
    git config core.precomposeunicode true
    git remote add origin git@github-azam:$2
    git remote update
    return 0
    fi
    }

    randpass() {
    cat /dev/urandom | env LC_CTYPE=C tr -dc "a-zA-Z0-9" | head -c 16
    echo
    return 0
    }

    run() {
    echo "$@"
    local n=$1
    shift
    # local c=$()
    # local q="'"
    # local qq='"'
    # for s in "$@"; do
    # c+=("${s//$q/$q$qq$q$qq$q}")
    # done
    # echo "${c[*]}"
    echo "$@"
    for i in `seq $n`; do
    # echo "${c[*]}" >> nohup.out.$i
    nohup $@ &> nohup.out.$i &
    done
    }

    zipall() {
    for i in */; do zip -r "${i%/}.zip" "$i"; done
    }