Permalink
Browse files

initial commit

  • Loading branch information...
vishnuatrai committed Oct 8, 2012
1 parent d87596c commit 25876b296897042ba90c4c4b7901594102a2f9ef
Showing with 726 additions and 0 deletions.
  1. +28 −0 README
  2. +75 −0 backup
  3. +13 −0 git_ignore
  4. +40 −0 gitconfig
  5. +29 −0 irbrc
  6. +178 −0 my_zshrc
  7. +335 −0 sake
  8. +10 −0 screenrc
  9. +18 −0 search_file
View
28 README
@@ -0,0 +1,28 @@
+* Setting this up *
+
+* Clone the repo:
+
+* Create couple of symbolic links:
+
+ $ ln -s ~/dot_files/my_zshrc ~/.zshrc
+ $ ln -s ~/dot_files/irbrc ~/.irbrc
+ $ ln -s ~/dot_files/gitconfig ~/.gitconfig
+ $ mkdir ~/bin (if bin directory doesn't exist)
+ $ ln -s ~/sake ~/bin/sake
+ $ ln -s ~/dot_files/screenrc ~/.screenrc
+
+* Modify ~/dot_files/my_zshrc
+
+ You may have to modify the my_zshrc file to your liking a bit. The PATH and
+ other stuff is configured according to the way, I have setup my machine.You may need to
+ change that.
+
+* Switch to zsh :
+
+ $ chsh
+
+* Close the terminal
+* Logout from your active session.
+* Open terminal and voila, you should have zsh with new prompt and everything working.
+
+
View
75 backup
@@ -0,0 +1,75 @@
+#!/usr/bin/env ruby
+
+require "rubygems"
+require "configatron"
+require "yaml"
+require "fileutils"
+
+class Backup
+ include FileUtils
+ attr_accessor :config, :config_dir
+ def initialize
+ @config_dir = File.join(ENV['HOME'],'.backup')
+ config_hash = YAML.load_file(File.join(config_dir,"backup.yml"))
+ configatron.configure_from_hash(config_hash)
+ end
+
+ def run_command(arg)
+ command = arg.first
+ unless can_backup?
+ puts "Warning - backup target is missing and cant run backups"
+ exit(1)
+ end
+ case command
+ when "archive"
+ archive_folders()
+ else
+ backup_all()
+ archive_folders()
+ end
+ end
+
+ def can_backup?
+ File.directory?(configatron.target)
+ end
+
+ def can_archive?
+ File.directory?(configatron.archive.source)
+ end
+
+ def archive_folders
+ return unless can_archive?
+ system("rsync #{rsync_command_options} #{configatron.archive.source} #{configatron.target}")
+ keep_dirs = configatron.archive.exclude.split(",")
+ keep_dirs.each do |dir|
+ tobe_deleted = File.join(configatron.archive.source,dir)
+ puts "Going to delete all contents of #{tobe_deleted}"
+ rm_r Dir.glob("#{tobe_deleted}/*")
+ end
+ end
+
+ def rsync_command_options
+ "-avl --inplace --stats --progress"
+ end
+
+ def backup_has_exclude?
+ File.exists?(backup_exclude)
+ end
+
+ def backup_exclude
+ File.join(config_dir,"exclude.txt")
+ end
+
+ def backup_all
+ if backup_has_exclude?
+ system("rsync #{rsync_command_options} --delete --exclude-from '#{backup_exclude}' #{configatron.backup.source} #{configatron.target}")
+ else
+ system("rsync #{rsync_command_options} --delete #{configatron.backup.source} #{configatron.target}")
+ end
+ end
+end
+
+if __FILE__ == $0
+ b = Backup.new()
+ b.run_command(ARGV)
+end
View
@@ -0,0 +1,13 @@
+.*.swp
+tags
+.swo
+*.elc
+jferris-*.gemspec
+*.scratch.*
+nbproject
+.idea
+.DS_Store
+.rbenv-version
+*.iml
+.rvmrc
+config/database.yml
View
@@ -0,0 +1,40 @@
+# ADD LOCAL CONFIGURATION HERE
+
+
+# DO NOT EDIT BELOW THIS LINE
+[color]
+ diff = auto
+ status = auto
+ branch = auto
+[core]
+ excludesfile = ~/.gitignore
+ editor = vim
+ autocrlf = input
+[alias]
+ ci = commit
+ co = checkout
+ c = commit -m
+ a = add
+ di = diff
+ dic = diff --cached
+ pl = pull
+ ps = push
+ plre = pull --rebase
+ st = status
+ out = log origin..HEAD
+ bra = branch -a
+
+[user]
+ name = Vishnu Atrai
+ email = me@vishnuatrai.com
+[mergetool "diffmerge"]
+ cmd = diffmerge --merge --result=$MERGED $LOCAL $BASE $REMOTE
+ trustExitCode = false
+[github]
+ user = vatrai
+[difftool "Kaleidoscope"]
+ cmd = ksdiff-wrapper git \"$LOCAL\" \"$REMOTE\"
+[difftool]
+ prompt = false
+[diff]
+ tool = Kaleidoscope
View
29 irbrc
@@ -0,0 +1,29 @@
+# print SQL to STDOUT
+if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER')
+ require 'logger'
+end
+
+# Autocomplete
+require 'irb/completion'
+
+# Prompt behavior
+ARGV.concat [ "--readline", "--prompt-mode", "simple" ]
+
+# History
+require 'irb/ext/save-history'
+IRB.conf[:SAVE_HISTORY] = 100
+IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
+
+# Easily print methods local to an object's class
+class Object
+ def local_methods
+ (methods - Object.instance_methods).sort
+ end
+end
+
+# copy a string to the clipboard
+def pbcopy(string)
+ `echo "#{string}" | pbcopy`
+ string
+end
+require "rubygems"
View
178 my_zshrc
@@ -0,0 +1,178 @@
+setopt correct
+
+# Use Emacs keybinds
+bindkey -e
+
+PS1='%2~> '
+
+setopt prompt_subst
+
+# git theming default: Variables for theming the git info prompt
+ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name
+ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt
+
+autoload colors zsh/terminfo
+ if [[ "$terminfo[colors]" -ge 8 ]]; then
+ colors
+ fi
+
+for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
+ eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
+ eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
+ (( count = $count + 1 ))
+done
+PR_NO_COLOUR="%{$terminfo[sgr0]%}"
+
+
+function precmd() {
+ head_info=$(git symbolic-ref HEAD 2> /dev/null)
+ # rvm_use=$(rvm info|egrep -C 1 'homes'|grep 'gem'|cut -d\: -f 2|cut -d\" -f 2 )
+ #
+ # if [[ $rvm_use =~ 'not set' ]]; then
+ # rvm_flag='system'
+ # else
+ # rvm_flag=$rvm_use[(ws:/:)-1]
+ # fi
+
+ rvm_prompt_info=$(~/.rvm/bin/rvm-prompt 2> /dev/null)
+
+ # if [[ $rvm_prompt_info =~ ' ' ]]; then
+ # rvm_flag='system'
+ # else
+ rvm_flag=$rvm_prompt_info
+ # fi
+
+ RPROMPT='$PR_RED$rvm_flag$PR_NO_COLOUR'
+ if [[ $head_info =~ '^refs*' ]]; then
+ branch_name=$head_info[(ws:/:)-1]
+ output=$(git diff-files --exit-code --quiet)
+ if [[ $? == 0 ]]; then
+ PROMPT='%2~ $PR_RED$ZSH_THEME_GIT_PROMPT_PREFIX$PR_NO_COLOUR$PR_GREEN$branch_name$PR_NO_COLOUR$PR_RED$ZSH_THEME_GIT_PROMPT_SUFFIX$PR_NO_COLOUR$PR_CYAN>$PR_NO_COLOUR '
+ else
+ PROMPT='%2~ $PR_RED$ZSH_THEME_GIT_PROMPT_PREFIX$PR_NO_COLOUR$PR_GREEN$branch_name$PR_NO_COLOUR$PR_RED$ZSH_THEME_GIT_PROMPT_SUFFIX$PR_NO_COLOUR$PR_MAGENTA*$PR_NO_COLOUR '
+ fi
+ else
+ PROMPT='%2~~>'
+ fi
+}
+
+#history stuff
+## Command history configuration
+HISTFILE=$HOME/.zsh_history
+HISTSIZE=10000
+SAVEHIST=10000
+
+setopt hist_ignore_dups # ignore duplication command history list
+setopt share_history # share command history data
+
+setopt hist_verify
+setopt inc_append_history
+setopt extended_history
+setopt hist_expire_dups_first
+
+# completion related stuff
+## fixme - the load process here seems a bit bizarre
+
+setopt noautomenu
+setopt complete_in_word
+setopt always_to_end
+
+unsetopt flowcontrol
+
+WORDCHARS=''
+
+autoload -U compinit
+compinit
+
+zmodload -i zsh/complist
+
+## case-insensitive (all),partial-word and then substring completion
+if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
+ zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
+ unset CASE_SENSITIVE
+else
+ zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
+fi
+
+zstyle ':completion:*' list-colors ''
+
+unsetopt MENU_COMPLETE
+#setopt AUTO_MENU
+
+# should this be in keybindings?
+bindkey -M menuselect '^o' accept-and-infer-next-history
+
+zstyle ':completion:*:*:*:*:*' menu yes select
+# zstyle ':completion:*:*:*:*:processes' force-list always
+
+zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
+zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
+
+# Load known hosts file for auto-completion with ssh and scp commands
+if [ -f ~/.ssh/known_hosts ]; then
+ zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts )
+ zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts`
+fi
+#end of completion related stuff
+
+# Aliases
+alias g='git'
+alias gst='git status'
+alias gl='git pull'
+alias gup='git fetch && git rebase'
+alias gp='git push'
+alias gd='git diff | mate'
+alias gdv='git diff -w "$@" | vim -R -'
+alias gc='git commit -v'
+alias gca='git commit -v -a'
+alias gb='git branch'
+alias gba='git branch -a'
+alias gcount='git shortlog -sn'
+alias gcp='git cherry-pick'
+alias grst='git reset --hard HEAD'
+alias gf="git fetch"
+alias gsi="git submodule init"
+alias gsu="git submodule update"
+alias grh="git reset --hard"
+alias s="sake"
+alias be="bundle exec"
+
+alias psr="ps axu|grep ruby"
+alias ..2="cd ../.."
+alias ..3="cd ../../.."
+alias r="rake"
+alias screen="screen -h 5000"
+alias emacs="open -a Emacs.app"
+alias em="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient --no-wait"
+alias cl="cd ~/apps/CyncAbl-R3"
+alias rls="cd ~/apps/rails"
+alias ls="ls -G"
+export EDITOR="vim"
+
+
+
+#export PATH=/opt/ree/bin:/opt/git/bin:/opt/local/bin:/opt/local/sbin:$HOME/bin:$PATH
+
+export PATH=/usr/local/bin:$HOME/bin:$PATH
+alias ru='ps -ef | grep ruby'
+
+export CC=/usr/bin/gcc-4.5
+export LC_CTYPE=en_US.UTF-8 export LC_ALL=en_US.UTF-8
+
+
+#export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/Cellar/mysql/5.1.55/lib"
+#rvm_archflags="-arch i386"
+
+#export JRUBY_OPTS=--1.9
+
+# Oracle specific
+export DYLD_LIBRARY_PATH="/usr/local/oracle/instantclient_10_2"
+export SQLPATH="/usr/local/oracle/instantclient_10_2"
+export TNS_ADMIN="/usr/local/oracle/network/admin"
+export NLS_LANG="AMERICAN_AMERICA.UTF8"
+export PATH=$PATH:$DYLD_LIBRARY_PATH
+
+source ~/apps/auto-rake/auto_rake.sh
+
+#[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
+PATH=$PATH:$HOME/.rvm/bin
Oops, something went wrong.

0 comments on commit 25876b2

Please sign in to comment.