Commits

tednaleid committed c7473e4

latest from home

  • Participants
  • Parent commits 4ee0b7e

Comments (0)

Files changed (2)

File zshrc_general

 export SVN_EDITOR='/usr/local/bin/mate -w'
 
 #export JAVA_OPTS="-Xms1538m -Xmx1538m -XX:MaxPermSize=512m"
-export JAVA_OPTS="-Xmx1024m -XX:MaxPermSize=512m"
+export JAVA_OPTS="-Xmx2048m -XX:MaxPermSize=512m"
 
 #export GRADLE_OPTS="-Xms2048m -Xmx2048m -XX:MaxPermSize=1024m"
-#export GRADLE_HOME='/usr/local/gradle'
+export GRADLE_HOME='/usr/local/gradle'
 export GRADLE_OPTS="-Xmx2048m -XX:MaxPermSize=1024m"
 export GRADLE_REPOSITORY="$HOME/.gradle"
 
 export DISPLAY="localhost:0.0"
 
 export WORKSPACE_DIR=~/Documents/workspace
-#export CATALINA_OPTS='-Xdebug -Xrunjdwp:transport=dt_socket,address=8999,server=y,suspend=n'
+export CATALINA_OPTS='-Xdebug -Xrunjdwp:transport=dt_socket,address=8999,server=y,suspend=n -Djava.awt.headless=true'
 export CATALINA_HOME='/usr/local/tomcat'
 
 export GRAILS_HOME='/usr/local/grails'
 export GROOVY_HOME='/usr/local/groovy'
+export VERTX_HOME='/usr/local/vertx'
 
 export MONGODB_HOME='/usr/local/mongodb'
 
 export RUBYOPT=rubygems
 
-PATH="$HOME/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$GROOVY_HOME/bin:$GRAILS_HOME/bin:$GRADLE_HOME/bin:/usr/local/redis:${PATH}"
-#PATH="$HOME/bin:/opt/local/sbin:/opt/local/bin:/usr/local/bin:/usr/local/mysql/bin:/usr/local/tomcat/bin:/usr/local/ant/bin:/usr/local/groovyserv/bin:$GROOVY_HOME/bin:$GRAILS_HOME/bin:$CATALINA_HOME/bin:/usr/local/redis:$M2:$SCALA_HOME/bin:$MONGODB_HOME/bin:$HOME/.gem/ruby/1.8/bin:${PATH}"
-
+PATH="$HOME/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$GROOVY_HOME/bin:$GRAILS_HOME/bin:$GRADLE_HOME/bin:$VERTX_HOME/bin:/usr/local/redis:$CATALINA_HOME/bin:${PATH}"
 
 export WORDS=/usr/share/dict/words
 
 # alias cp='nocorrect cp'
 # alias mkdir='nocorrect mkdir'
 
+md() {
+    mkdir $1 && cd $1
+}
+
 alias cdw='cd ${WORKSPACE_DIR}'
 
 cdWhichDirname() {
 
 alias ipadchrome='open /Applications/Google\ Chrome.app   --args -user-agent="Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10"'
 
+
+# takes rdf triple .nt file and emits subjectids
+alias subjectids=getsubjectids
+
+function getsubjectids() {
+    cutcol 1 $1 | sed -e 's/<\(.*\)>/\1/'
+}
+
 # from steve losh tweet
 alias collapse="sed -e 's/  */ /g'"
 alias cuts="cut -d' '"
 alias -g XG="| xargs grep -ni"
 alias -g L='| less'
 alias -g PBC='| pbcopy'
+alias -g X1="| xargs -L1"
 
 
 alias sortlssize='sort -k 5 -n'
 
-alias cutcol=pc
-pc() { awk "{print \$$1}" }  # print column
+alias cutcol='cut -d\  -f'
+#alias cutcol=pc
+#pc() { awk "{print \$$1}" }  # print column
 
 rot13 () { tr "[a-m][n-z][A-M][N-Z]" "[n-z][a-m][N-Z][A-M]" }
 
 # starts a server on port 8000 that makes the current directory browsable with a webbrowser
 alias webshare='python -m SimpleHTTPServer'
 
+function server() {
+    local port="${1:-8000}"
+    open "http://localhost:${port}/"
+    python -m SimpleHTTPServer "$port"
+}
+
 alias oc='open -a Console.app'
 alias airport='/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I'
 
 alias lcl='launchctl list'
 alias lcs='launchctl start'
 
+longestline() { awk '{ print length, $0}' $1 | sort -nr | head -1 }
 
 
 # print the contents of a single line (passed in as an argument)
 ## TRAFFIC MONITORING ##
 
 # Need to use ports/brew to install "tcpflow" for this to work
+# for listening to external machines calling us
 alias tcpf80='sudo tcpflow -c -i en1 port 80'
 alias tcpf8080='sudo tcpflow -c -i en1 port 8080'
 
+
+# for listening to loopback port where we're talking to ourselves
 alias tcpfl8080='sudo tcpflow -c -i lo0 port 8080'
+alias tcpflp='sudo tcpflow -c -i lo0 port' # add the port
 
 alias tcpd8080="sudo tcpdump -s 0 -A -i lo0 'tcp port 8080 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'"
 
 
 # Need to use ports/brew to install "ngrep" for this to work
 alias ngrep8080='sudo ngrep -q -l -W byline -d lo0 port 8080'
+alias ngrepp='sudo ngrep -q -l -W byline -d lo0 port ' # just add the port
 
 # show open ports
 alias op='lsof -i'
 alias pyg='pygmentize -l ruby -P "style=native" -f rtf -o out.rtf '
 
 alias jsonpretty='curl "$*" | python -mjson.tool | pygmentize -l javascript'
+alias jsontidy='curl "$*" | python -mjson.tool'
 alias pbjsonpretty='pbpaste | python -mjson.tool | pygmentize -l javascript'
+alias pbjsontidy='pbpaste | python -mjson.tool'
+
+
+# brew install xmlstarlet
+# sudo easy_install pygments
+alias xmlpretty='xml fo | pygmentize -l xml' 
+
+function ps_status() {
+    PID=$(ps -el | grep $1 | grep -v grep | cut -c 7-12)
+
+    if [ $PID ]; then
+        echo "$1 is runing, PID = $PID"
+    else
+        echo "$1 is not running"
+    fi
+}    
+
+# httpie repl prompt, install with:
+# brew install repl
+# sudo easy_install pip
+# sudo pip install httpie 
+# repl http
+alias httprepl='repl http'
 
 alias ec2i=ec2_instance_info
 function ec2_instance_info() {
 }
 
 
+alias sublproj=sublproject
+function sublproject() {
+    if [ -z $1 ]; then
+        echo "missing required project name"
+        exit 1
+    fi
+
+    PROJ=$1.sublime-project
+    SCRIPT=$1.command
+
+    cat <<EOF>$PROJ
+{
+    "folders":
+    [
+        {
+            "path": "$(pwd)"
+        }
+    ]
+}
+EOF
+
+    cat <<EOF>$SCRIPT
+#! /usr/bin/env bash
+BASEDIR=\$(dirname \$0)
+cd \$BASEDIR
+subl $PROJ
+EOF
+    chmod +x $SCRIPT
+
+}
+
 alias mvimproj=mvimproject
 function mvimproject() {
     SCRIPT='mvimhere.command'
 alias gs="git status --short"
 alias grh="git reset --hard"
 
+alias gt="gittower"
+
+alias gb="git branch -avv"
+# diff against master with difftool
+alias gdm="git branchdiff"
+
+alias gd="git diff"
+
+alias grom="git rebase -p origin/master"
 
 alias svn14="/usr/bin/svn"
 alias ss="svn status"
 
 alias rmideacache='rm -rf ~/Library/Caches/IntelliJIdea11/caches'
 
+alias oi="open *.ipr"
+
 alias tpush='hg commit || hg fetch && gta && hg push'
 alias tspush='hg commit || hg fetch && splitTests.groovy && hg push'
 
 alias idea='open -a /Applications/Maia-IU-95.214.app'
 alias g='grails'
 
-# grails > 1.2
+alias gkill='kill -9 $(jps | grep GrailsStarter | cut -f1 -d\ )'
+
 export GRAILS_TEST_LOG_DIRECTORY=target/test-reports
 
-# grails < 1.2
-# export GRAILS_TEST_LOG_DIRECTORY=test/reports
+function grailsTestOrder() {
+    grep testsuite target/test-reports/TESTS-TestSuites.xml | grep -v testsuites | cut -d\  -f8-9 | sed -E 's/name="(.*)" package="(.*)"/\2.\1/' | grep .
+}
+
+alias testorder=grailsTestOrder
+
+function grailsTestOrderTime() {
+    # for some reason, sometimes they aren't in there in sorted order, so use the timestamp to order them.  Not perfect as it's precision is to the second and some tests can run in the same second
+    grep testsuite target/test-reports/TESTS-TestSuites.xml | grep -v testsuites | cut -d\  -f8-12 | sed -E 's/name="([^"]*)" package="([^"]*)".*timestamp="([^"]*)"./\3 \2.\1/' | sort | cut -d\  -f2 | grep .
+}
+
+alias testorder=grailsTestOrderTime
+
+
+alias alwaysbedebugginggrails='cp $GRAILS_HOME/bin/grails{,-nd} && sed -e 's/suspend=y/suspend=n/' $GRAILS_HOME/bin/grails-debug > $GRAILS_HOME/bin/grails && chmod +x $GRAILS_HOME/bin/grails'
 
 alias testhtml='open target/**/index.html'
 
 alias testlog='for F in `grep -lE "FAILED|Caused\ an\ ERROR" $GRAILS_TEST_LOG_DIRECTORY/plain/*.txt`; do echo ">>> opening" $F; open -a Console $F; done;'
 alias testlogts='for F in `grep -lE "FAILED|Caused\ an\ ERROR" test-*/test-reports/plain/*.txt`; do echo ">>> opening" $F; open -a Console $F; done;'
 
+alias gtr='open target/test-reports/html/index.html'
+
 
 # aliases where you can optionally pass in a set of tests to run (or no argument to run all tests in that group)
 alias gta=grailsTestApp
 }
 
 function grailsTest() {
-	echo "Running: $1 test-app -no-reports -echoOut $2 $3 || testlog "
-    time $1 test-app -no-reports -echoOut $2 $3 || testlog
+	echo "Running: $1 test-app $2 $3 || open target/test-reports/html/index.html"
+    # time $1 test-app -no-reports -echoOut $2 $3 || testlog
+    # in grails 2 it's easier to just look at the reports with the `gtr` alias if things fail
+    time $1 test-app $2 $3 || open target/test-reports/html/index.html
 }
 
-
-
-
 alias gtas='splitTests.groovy'
 
 alias gp='grails package'
 alias g137='switchGrails "groovy-1.7.5" "grails-1.3.7"'
 alias g200='switchGrails "groovy-1.8.4" "grails-2.0.0"'
 alias g201='switchGrails "groovy-1.8.6" "grails-2.0.1"'
+alias g203='switchGrails "groovy-1.8.6" "grails-2.0.3"'
+alias g204='switchGrails "groovy-1.8.6" "grails-2.0.4"'
+alias g210='switchGrails "groovy-1.8.6" "grails-2.1.0"'
 alias ggit='switchGrails "groovy-1.8.4" "grails-git"'
 
 function switchGrails() {
 
 alias redisstart='sudo launchctl start io.redis.redis-server'
 alias redisstop='sudo launchctl stop io.redis.redis-server'
+alias redisstatus='redis-cli ping'
+
+alias rc='redis-cli'
+alias rcfa='redis-cli flushall'
+alias rcdb='redis-cli flushdb'
+alias rcm='redis-cli monitor | grep -v \"LPOP\"\ \"resque:queue:'
 
 
 
 }
 
 dependencies {
-    groovy 'org.codehaus.groovy:groovy:1.8.6'
-    compile 'org.apache.ivy:ivy:2.2.0'
+    groovy 'org.codehaus.groovy:groovy-all:1.8.6'
+    groovy 'org.apache.ivy:ivy:2.2.0'
+    testCompile 'junit:junit:4.10'
 }
 
 task createSourceDirs(description : 'Create empty source directories for all defined sourceSets') << {
     }
 }
 
+wrapper(type: Wrapper)
+    gradleVersion = '1.0'
+}
+
 idea {
     project {
         jdkName = '1.6'
+        ipr {
+            withXml { provider ->
+                provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping.@vcs = 'Git'
+            }
+        }
+    }
+    module {
+        downloadSources = true
+        downloadJavadoc = true
     }
 }
 EOF
 export PATH=$PATH:$HADOOP_HOME/bin
 
 export HADOOP_HEAPSIZE=2000
-export HADOOP_OPTS="-server -Djava.security.krb5.realm=OX.AC.UK -Djava.security.krb5.kdc=kdc0.ox.ac.uk:kdc1.ox.ac.uk"
+export HADOOP_OPTS="-Djava.security.krb5.realm= -Djava.security.krb5.kdc="
 
 alias hadoopstart='start-all.sh'
 alias hadoopstop='stop-all.sh'
 # delete localhost entry from known hosts so we can loopback connect to various machines for hadoop
 alias dkh='wc -l ~/.ssh/known_hosts && cp ~/.ssh/known_hosts ~/.ssh/known_hosts.bak && grep -v localhost ~/.ssh/known_hosts.bak > ~/.ssh/known_hosts && wc -l ~/.ssh/known_hosts'
 
+# hadoop dfs commands
+for CMD in "ls" "cat" "tail" "rm" "rmr" "mkdir" "chown" "chmod"; do
+    alias "h$CMD"="hadoop dfs -$CMD"
+done
 
+
+## TOMCAT/CATALINA ##########################################################################################################
+
+alias cdtl="cd $CATALINA_HOME/logs"
+alias tstart="catalina start"
+alias tstop="catalina stop"
+alias trestart="tstop; tstart"
+alias ttail="cdtl && tail -100F catalina.out"
+alias tstatus='ps_status "tomcat"'
+
+alias sshtailtomcat=tailtomcat
+function tailtomcat() {
+    ssh $1 tail -f /var/log/tomcat6/catalina.out
+}
+

File zshrc_grails_compinstall

    	fi
 }
 
-compdef _hg hg
+compdef _hg hg
+
+# speed up git autocompletion, don't care about remote files just local branches and files, otherwise have to hit ctrl-c to get completion to short circuit before heat death of universe
+__git_files () { 
+    _wanted files expl 'local files' _files
+}
+