Wind__Fantasy

导航

Win7下CygWin的Bash启动脚本备份副本(仅供自己使用)

alias grep='grep --color=auto'
alias ls='ls --color'
alias gb='git branch' gc='git checkout' gl='git log' ga='git add' gd='git diff' gs='git status' grs='git reset' grsh='git reset HEAD' gcm='git commit -m' gct='git commit' gcb='git checkout -b' gdc='git diff --cached' gp='git pull' gsi='git submodule init' gsu='git submodule update'
#PATH="$PATH:/_cygdrive/c/Program Files (x86)/Git/bin";
alias g='~/g' dv='~/dl.py' flvmerge='~/flvmerge' taomp3='~/taomp3' m='cd ~/music/manual'
alias ep='vim ~/.bashrc' rp='. ~/.bashrc'
alias xcurl='curl -x 192.168.10.152:3128' 
alias gbc='gb | grep -oP "(?<=^\* ).+"'
alias gdl='gl --pretty=oneline | head -n 2 | grep -oP "^\w+" | xargs -L 2 git diff -R'

alias google='/cygdrive/c/Users/jian/AppData/Local/Google/Chrome/Application/chrome.exe'
alias _oi='google "http://sh.thenetcircle.com:8001/issues/$(gbc | grep -oP -m 1 "(?<=feature/|bug/)\d+")"'

alias oi='if ! tasklist | grep -q chrome.exe; then eval "_oi &"; else _oi; fi'

alias fcs='iconv -f gbk -t utf-8'

alias npp='"/cygdrive/C/Program Files (x86)/Notepad++/notepad++.exe"'

alias getmail="curl -A 'Mozilla/5.0' -b /tmp/cookie -d \"loginOp=login&username=\$(whoami)&password=\$(pswd)&client=standard\" -sL http://sh.thenetcircle.com/zimbra/ | awk '/mess_list_tbody\">/,/<\/tbody>/' | grep -oP \"(?<=<td width='160'>).+|(?<=<span>).+?(?=</span>)\" | sed '\$!N;s/\n/:\t/' | sed 's/\.\{3\}//g' | sed \"s/&#039;/'/g\""

alias genjs='php web/js/app/build_tnc-poppen.js.php; java -Xmx32m -jar $(winpath /home/jian/poppen/web/js/app/tools/yuicompressor-2.4.6.jar) --charset UTF-8 $(winpath /home/jian/poppen/web/js/tnc-poppen.js) -o $(winpath /home/jian/poppen/web/js/tnc-poppen-min.js)'

alias apc="ssh bart 'sudo /srv/www/poppen.lab/jian/bin/apc'"

function fs() {
  dir="$2" 
  if [ -z "$2" ]; then
    dir=.
  fi
  grep -nFr $3 "$1" "$dir" 2> /dev/null 
}

function ff() {
  dir="$2"
  if [ -z "$2" ]; then
    dir=.
  fi
  find "$dir" -name "$1*" $3
}

function dp() {
  ./symfony sync "$(whoami)_$1" --go
}
function upper() {
  echo "$*" | awk '{ print toupper($0); }' 
}
function key() {
  upper "$*" | sed 's/\s\+/_/g' 
}
function stripcr() {
  if [ -f "$1" ]; then
    temp=temp1234567890
    cat "$1" | awk '{ sub(/\r(?=\n)/, ""); print; }' > "$temp"
    mv "$temp" "$1"
  fi 
}
function o() {
  explorer "$(winpath $1)"
}
function dm() {
  if [ -z "$2" ]; then
    options='-O'
  else
    options="-o"
  fi
  curl -L "$options" "$2"  "$1" 
}

function gpr() {
  branch="$(gbc)"
  if echo "$branch" | grep -qiP 'develop|master'; then
    echo '!! How can you push it to develop or master directly, fuck? !!'
    return 1
  fi
  git push origin "$branch"
  echo "Successfully push '$branch' to remote branch" 
}

function srv() {
  net "$1" "$2" 2>&1 | fcs
} 

function winkill() {
  taskkill /f /im "$1" 2>&1 | fcs
}

function winpath() {
  dir="$1"
  if [ -z "$1" ]; then
    dir=.
  fi
  echo "$(realpath $dir)" | sed 's#/#\\#g' | sed 's/^\\/C:\\cygwin\\/'
}

function cygpath_() {
  dir="$1"
  if [ -z "$1" ]; then
    dir=.
  fi
  echo "$dir" | sed 's#\\#/#g' | sed 's#^\([a-z]\):#/cygdrive/\1#'
}

function pswd() {
  local pswd
  trap 'stty echo;return 2> /dev/null' SIGINT
  echo -n 'Password: ' 1>&2
  stty -echo
  read pswd
  echo $pswd
  stty echo
  echo 1>&2 
}

function hnm() {
  local old='/tmp/tempoldmail'
  local new='/tmp/tempnewmail'
  if ! [ -f "$old" ]; then
    touch "$old"
  fi
  getmail | head > "$new"
  if ! diff -q "$new" "$old" > /dev/null; then
    echo 'Has new mail, latest 10 mails(NOTALLARENEW) are: '
    echo '-----------------------------------------------------------------------------------'
    cat "$new"
    echo '-----------------------------------------------------------------------------------'
    mv "$new" "$old"
  else
    echo 'No new mail arrived. :)'
  fi
}

function vscp() {
  dsthost='root@199.114.240.73:'
  src="$1"
  dst="$2"
  if [ "$1" = "-r" ]; then
    srchost="$dsthost"
    dsthost=
    src="$3"
    dst="$2"
  fi
  if [ -z "$src" ]; then
    echo 'src directory not specified'
    echo 'Usage: vscp localsrcdir [ remotedstdir ] # for upload'
    echo '       vscp -r localdstdir remotesrcdir  # for download'
    return 1
  fi
  if [ -z "$dst" ]; then
    dst=.
  fi
  scp "$srchost$src" "$dsthost$dst"
}

PROMPT_COMMAND='if ~/strpos "$PS1"; then export PS1="\e[1;36m$(date +%R) \e[1;32m\w\e[1;37m> \e[m"; fi;'

#trap '' SIGWINCH
source ~/.git-completion.bash

posted on 2012-05-28 12:59  Wind__Fantasy  阅读(554)  评论(0编辑  收藏  举报