diff --git a/bashrc b/bashrc index bdba00f..5522652 100755 --- a/bashrc +++ b/bashrc @@ -21,14 +21,15 @@ export RUBY_SCRIPT_PATH=~/ruby # export P4DONTCHECKIN=$(p4 -P $P4TICKET changes -u i819885 -s pending -c gsecil-linux-main | grep DO-NOT-CHECK-IN | cut -d' ' -f 2) #fi -export http_proxy=http://proxy:8080 -export https_proxy=$http_proxy -export no_proxy=localhost +#export http_proxy=http://proxy:8080 +#export https_proxy=$http_proxy +#export no_proxy=localhost export GIT_SSL_NO_VERIFY=true #alias t='tail -f $PWD/log/development.log' -#alias irb=~/bin/irb #alias rake='jruby -S rake' #alias gem='jruby -S gem' -#alias T='jruby -J-Xmx1300m -J-XX:MaxPermSize=256m -I $RUBY_SCRIPT_PATH -rfast_fail_runner test/all_tests.rb -v --runner=fastfail' -#alias ls='ls --color' +alias T='jruby -J-Xmx1300m -J-XX:MaxPermSize=256m -I $RUBY_SCRIPT_PATH -rfast_fail_runner test/all_tests.rb -v --runner=fastfail' +alias ls='ls -G' + +PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting diff --git a/bin/edit b/bin/edit deleted file mode 100755 index 9da7342..0000000 --- a/bin/edit +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# -# - - -while getopts "c:" flag -do - echo $flag $OPTARG - case "$flag" in - c) - changelist="-c $OPTARG" - shift - shift - ;; - esac -done - -if [ -z $1 ] -then - while read data; do - p4 edit $changelist -f "$data" - done -else - p4 edit $changelist -f "$1" -fi - diff --git a/bin/fio-test b/bin/fio-test new file mode 100755 index 0000000..e885c6d --- /dev/null +++ b/bin/fio-test @@ -0,0 +1,28 @@ +#!/bin/sh +# +# + +dir=$(dirname $0) + +for h in $(cat /tmp/hosts) +do + echo '========================' + echo $h + ssh cubetree@$h hostname + echo '========================' + scp $dir/runfio cubetree@$h:. + ssh cubetree@$h grep file_store /proc/mounts + ssh cubetree@$h mkdir -p /data/file_store/test + ssh cubetree@$h ./runfio /data/file_store/test 2>&1 > /dev/null + ssh cubetree@$h cat fio.out + echo '---------------------------------------' + echo /tmp + ssh cubetree@$h ./runfio /tmp 2>&1 > /dev/null + ssh cubetree@$h cat fio.out + echo '---------------------------------------' + echo dd throughput + ssh cubetree@$h 'dd if=/dev/zero of=/data/file_store/test/ddtest count=256k 2>&1' + echo '---------------------------------------' + ssh cubetree@$h rm -r /data/file_store/test +done + diff --git a/bin/git_svn_branch_checkout b/bin/git_svn_branch_checkout index ce3eee7..c5ff251 100755 --- a/bin/git_svn_branch_checkout +++ b/bin/git_svn_branch_checkout @@ -1,11 +1,11 @@ -#!/bin/bash -x +#!/bin/bash # -SVNREPO_BASE=https://robleslabs.svn.cvsdude.com/ct +SVNREPO_BASE=$(git svn info | grep 'Repository Root:' | sed 's/Repository Root: //') svn_remote() { echo "[svn-remote \"svn-$1\"] - url = https://robleslabs.svn.cvsdude.com/ct/branches/$1 + url = $SVNREPO_BASE/branches/$1 fetch = :refs/remotes/svn-$1 " >> .git/config @@ -13,7 +13,7 @@ svn_remote() { usage() { echo "Usage: - git_svn_branch_checkout [SVN branch] + $(basename $0) [SVN branch] " exit 1 } diff --git a/bin/runfio b/bin/runfio new file mode 100755 index 0000000..96236fb --- /dev/null +++ b/bin/runfio @@ -0,0 +1,20 @@ +#!/bin/sh +# + +sudo apt-get -y -q install fio 2>&1 > /dev/null +cat - < /tmp/random.fio +; random read of 128mb of data + +[random-read] +;numjobs=5 +rw=randread +size=128m +;directory=/data/file_store/test +;directory=/mnt/test +;directory=/tmp +directory=$1 + +EOF +fio /tmp/random.fio 2>&1 | tee fio.out +sudo apt-get -y -q purge fio libaio1 2>&1 > /dev/null + diff --git a/bin/websocketd b/bin/websocketd new file mode 100644 index 0000000..62c9772 Binary files /dev/null and b/bin/websocketd differ diff --git a/gitattributes b/gitattributes new file mode 100644 index 0000000..daae0e0 --- /dev/null +++ b/gitattributes @@ -0,0 +1 @@ +config/deploy.rb filter=rcs-keyword diff --git a/gitconfig b/gitconfig new file mode 100644 index 0000000..f1d8ee4 --- /dev/null +++ b/gitconfig @@ -0,0 +1,19 @@ +[user] + name = Secillano, George + email = george.secillano@gmail.com +[core] + excludesfile = /Users/i819885/.gitignore_global + attributesfile = /Users/i819885/.gitattributes +[difftool "sourcetree"] + cmd = opendiff \"$LOCAL\" \"$REMOTE\" + path = +[mergetool "sourcetree"] + cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\" + trustExitCode = true +[http] + ;proxy = proxy:8080 +[filter "rcs-keyword"] + clean = perl -pe \"s/\\\\\\$HeadURL[^\\\\\\$]*\\\\\\$/\\\\\\$HeadURL\\\\\\$/\" + smudge = "perl -pe \"s/\\\\\\$HeadURL[^\\\\\\$]*\\\\\\$/\\\\\\$Head`git svn info | grep URL | sed \"s#/#\\\\\\\\\\/#g\"`\\\\/\\\\\\$/\"" +[init] + templatedir = ~/.gittemplates diff --git a/gittemplates/hooks/post-checkout b/gittemplates/hooks/post-checkout new file mode 100755 index 0000000..c34845b --- /dev/null +++ b/gittemplates/hooks/post-checkout @@ -0,0 +1,12 @@ +#!/bin/bash +# + + lock=/tmp/post-checkout.lock +if [ -f $lock ] +then + rm /tmp/post-checkout.lock +else + touch $lock + rm config/deploy.rb + git checkout config/deploy.rb +fi diff --git a/lighttpd.conf b/lighttpd.conf index af89a16..a068bc0 100644 --- a/lighttpd.conf +++ b/lighttpd.conf @@ -2,7 +2,7 @@ server.port = 80 #server.document-root = "/home/george/dev/constellation/whohar/public" -server.document-root = "/home/george/projects/cubetree/public" +server.document-root = "/Users/i819885/jam/ct/public" server.modules = ( "mod_proxy" ) @@ -32,16 +32,27 @@ $HTTP["url"] =~ "^/cometd" { proxy.server = ( "" => ( ( - "host" => "127.0.0.1", - "port" => "3000" + "host" => "10.8.70.30", + "port" => "80" ), ( - "host" => "127.0.0.1", - "port" => "3002" + "host" => "10.8.70.31", + "port" => "80" ) ) ) +#proxy.server = ( "" => + #( ( + #"host" => "127.0.0.1", + #"port" => "3000" + #), + #( + #"host" => "127.0.0.1", + #"port" => "3002" + #) ) +#) + $SERVER["socket"] == ":443" { ssl.engine = "enable" - ssl.pemfile = "/etc/lighttpd/server.pem" + ssl.pemfile = "server.pem" } diff --git a/ssh_config b/ssh_config index 36e8196..c92a847 100755 --- a/ssh_config +++ b/ssh_config @@ -65,3 +65,61 @@ Host github.com PreferredAuthentications publickey Hostname ssh.github.com Port 443 + +Host vanl00479590a + User george + +# DC2 jumphost +Host 10.2.30.70 + User I819885 + +# DC4 jumphost +Host 10.4.196.175 + User I819885 + +# DC8 jumphost +Host 10.8.196.50 + User I819885 + +# DC10 jumphost +Host 10.10.198.30 + User I819885 + +# DC2 devops host +Host 10.2.70.20 + User devops + #ProxyCommand ssh 10.2.30.70 netcat %h %p + ProxyCommand ssh 10.4.196.175 netcat %h %p + +# DC4 devops host +Host 10.4.70.21 + User devops + ProxyCommand ssh 10.4.196.175 netcat %h %p + +# DC8 devops host +Host 10.8.70.20 + User devops + ProxyCommand ssh 10.8.196.50 netcat %h %p + +# DC10 devops host +Host 10.10.70.20 + User devops + ProxyCommand ssh 10.10.198.30 netcat %h %p + +# DC12 devops host +Host 10.118.70.55 + User devops + ProxyCommand ssh 10.4.70.21 netcat %h %p + +Host 10.100.* 10.10.* 10.4.* 10.5.* 10.8.* 10.2.* 10.12.* + User cubetree + +#Host ci.cubetree.com + #User root + #IdentityFile Documents/ec2-stage.pem + +Host 10.0.0.* + User cubetree + ProxyCommand ssh cubetree@54.236.134.49 nc %h %p + + diff --git a/zshrc b/zshrc index 0c00e34..d13e621 100644 --- a/zshrc +++ b/zshrc @@ -5,6 +5,7 @@ ZSH=$HOME/.oh-my-zsh # Look in ~/.oh-my-zsh/themes/ # Optionally, if you set this to "random", it'll load a random theme each # time that oh-my-zsh is loaded. +#ZSH_THEME="agnoster" ZSH_THEME="robbyrussell" #ZSH_THEME=$(cat ~/.zsh-theme) @@ -30,7 +31,7 @@ ZSH_THEME="robbyrussell" # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) -plugins=(cap git gem bundler rails ruby autojump zeus) +plugins=(cap git gem bundler rails autojump zeus rvm gitflow) source $ZSH/oh-my-zsh.sh source $HOME/.bashrc @@ -49,14 +50,15 @@ alias stopdebian='vmrun stop /vmware/debian/debian.vmx nogui 2>&1 > /dev/null' ctrepo() { echo 'https://robleslabs.svn.cvsdude.com/ct' } -sp(){ +setproxy(){ export http_proxy=http://proxy:8080 export https_proxy=$http_proxy + export ftp_proxy=$http_proxy sed -i.bak 's/#http-proxy-host/http-proxy-host/' ~/.subversion/servers sed -i.bak 's/#http-proxy-port/http-proxy-port/' ~/.subversion/servers sed -i.bak 's/;proxy/proxy/' ~/.gitconfig } -up() { +unsetproxy() { unset http_proxy unset https_proxy sed -i.bak 's/^http-proxy-host/#http-proxy-host/' ~/.subversion/servers @@ -68,8 +70,97 @@ up() { alias ls='ls -G' PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting -alias vpn='ikec -a -r SF-ALL-ADMIN -u i819885 -p' +PATH=/usr/local/bin:/usr/local/sbin:$PATH + +# VPN management. Requires Shrewsoft VPN client +vpn() { + case "$1" in + "check") + sudo nmap -PN -sU -p 500 12.178.105.137 + ;; + "stop") + killall ikec > /dev/null 2>&1 || echo 'VPN client not running' + ;; + "") + # status + RETVAL=0 + ifconfig | grep -A3 tap0: || { echo "VPN is disconnected" && RETVAL=1 } + [ $RETVAL -eq 0 ] + ;; + *) + vpn && { echo "VPN is active. Doing nothing" && return } + vpn stop + nohup ikec -a -r SF-ALL-ADMIN -u i819885 -p "$1" < /dev/null > ~/tmp/ikec.log 2>&1 & + while true; do + vpn && break + sleep 1; + done + ;; + esac +} #ping proxy 2>& > /dev/null && sp -ping -c 1 proxy > /dev/null 2>&1 && sp +dc() { + IP=$1 + DCNUM="$(echo $IP | cut -d. -f2)" + case $DCNUM in + 2) + GW=10.2.70.20 + ;; + 4) + GW=10.4.70.21 + ;; + 8) + GW=10.8.70.20 + ;; + 10) + GW=10.10.70.20 + ;; + 118) + GW=10.118.70.55 + ;; + *) + echo "Unsupported DC" + return 1 + ;; + esac + + CMD="ssh $GW -t" + if [ ${#IP} -gt 3 ] + then + CMD="$CMD \"scp .georgerc cubetree@$IP:/tmp/.; ssh -t cubetree@$IP bash --init-file /tmp/.georgerc\"" + else + CMD="$CMD bash --init-file .georgerc" + fi + bash -c "$CMD" +} + +nodes() { + grep -i "$1" config/deploy/instances/$2.rb | grep -o "10\..*" | sed -e "s/['\",]//g" | sort | uniq +} + +ctapp() { + nodes "ctapp" $1 +} + +ctutil() { + nodes "ctutil\|ctcron" $1 +} + +s() { + HOST=$1 + ssh -t cubetree@$HOST.sapjam.com bash --init-file .georgerc +} + +alias vi='/usr/local/bin/vim' +alias vim='/usr/local/bin/vim' +alias log2='dc 10.2.72.11' +alias log4='dc 10.4.72.10' +alias sdlog4='dc 10.4.72.90' +alias log8='dc 10.8.72.15' +alias sdlog8='dc 10.8.70.41' +alias log10='dc 10.10.72.11' +alias log12='dc 10.118.70.53' +### Added by the Heroku Toolbelt +export PATH="/usr/local/heroku/bin:$PATH"