Last active
November 15, 2016 05:56
-
-
Save shobhitsinghal624/7192658 to your computer and use it in GitHub Desktop.
Scripts to initialize a new ubuntu instance (apt-get installs; .screenrc; .vimrc)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = Shobhit Singhal | |
email = shobhitsinghal624@gmail.com | |
[color] | |
ui = auto | |
[push] | |
default = current | |
[pull] | |
default = current | |
[diff] | |
tool = vimdiff | |
[difftool] | |
prompt = false | |
[alias] | |
st = status | |
dt = difftool | |
co = checkout | |
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %Cblue<%an>%Creset' --abbrev-commit --date=relative | |
lgs = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %Cblue<%an>%Creset' --abbrev-commit --date=relative --stat | |
lgp = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %Cblue<%an>%Creset' --abbrev-commit --date=relative -p | |
lgsp = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %Cblue<%an>%Creset' --abbrev-commit --date=relative --stat -p | |
lgps = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %Cblue<%an>%Creset' --abbrev-commit --date=relative --stat -p | |
fp = fetch -p | |
# Show all of my configured aliases | |
aliases = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\ \t\\2/' | sort | |
# List various branches | |
list-branch-core = !git for-each-ref --sort=-committerdate --format='%(HEAD)%(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative))%(color:reset) %(color:blue)<%(authorname)>%(color:reset)' refs/ | |
list-branch = !git list-branch-core | less -R | |
list-branch-n = !git list-branch-core --count=$1 | |
list-branch-format-2 = !git for-each-ref --sort=-committerdate --format='%(color:red)%(objectname:short)%(color:reset) %(color:green)%(committerdate:iso8601)%(color:reset) %(color:blue)<%(authorname)>%(color:reset) %(HEAD)%(color:yellow)%(refname:short)%(color:reset) - %(contents:subject)' refs/ | sed -r 's/(^.{37})(.{9})(.*)/\\1\\3/g' | less -R | |
up = !git stash && git pull && git stash pop | |
#syncupstream = !git fetch upstream && git merge upstream/master | |
syncupstream = !git stash && git fetch -p upstream && git merge upstream/${1:-`git rev-parse --abbrev-ref HEAD`} && git stash pop | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bind F11 and F12 (NOT F1 and F2) to previous and next screen window | |
bindkey -k F1 prev | |
bindkey -k F2 next | |
startup_message off | |
# Window list at the bottom. | |
hardstatus alwayslastline | |
hardstatus string "%-w%{= BW}%50>%n %t%{-}%+w%<" | |
# From Stephen Shirley | |
# Don't block command output if the terminal stops responding | |
# (like if the ssh connection times out for example). | |
nonblock on | |
# Allow editors etc. to restore display on exit | |
# rather than leaving existing text in place | |
altscreen on | |
# Enable 256-color mode when screen is started with TERM=xterm-256color | |
# Taken from: http://frexx.de/xterm-256-notes/ | |
# | |
# Note that TERM != "xterm-256color" within a screen window. Rather it is | |
# "screen" or "screen-bce" | |
# | |
# terminfo and termcap for nice 256 color terminal | |
# allow bold colors - necessary for some reason | |
attrcolor b ".I" | |
# tell screen how to set colors. AB = background, AF=foreground | |
#termcapinfo xterm-256color 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" [Start] vundle config | |
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'kien/ctrlp.vim' | |
Plugin 'Yggdroot/indentLine' | |
Plugin 'vim-airline/vim-airline' | |
Plugin 'vim-airline/vim-airline-themes' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'Raimondi/delimitMate' | |
Plugin 'jelera/vim-javascript-syntax' | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
" [End] vundle config | |
" set 256 color | |
set t_Co=256 | |
syntax on " enable syntax processing | |
set ruler " show the line number on the bar | |
set more " use more prompt | |
set autoread " watch for file changes | |
"set number " show line numbers | |
set hidden | |
set noautowrite " don't automagically write on :next | |
"set lazyredraw " don't redraw when don't have to | |
set showmode | |
set showcmd | |
set nocompatible " vim, not vi | |
set autoindent smartindent " auto/smart indent | |
set smarttab " tab and backspace are smart | |
set expandtab " replace tab with spaces | |
set tabstop=2 " number of visual spaces per TAB, 2 spaces | |
set softtabstop=2 " number of spaces in tab when editing | |
set shiftwidth=2 " number of columns text is indented with reindent operations (<< and >>) | |
set scrolloff=5 " keep at least 5 lines above/below | |
set sidescrolloff=5 " keep at least 5 lines left/right | |
set history=200 | |
set backspace=indent,eol,start | |
set linebreak | |
"set cmdheight=2 " command line two lines high | |
set undolevels=1000 " 1000 undos | |
set updatecount=100 " switch every 100 chars | |
set complete=.,w,b,u,U,t,i,d " do lots of scanning on tab completion | |
set ttyfast " we have a fast terminal | |
set noerrorbells " No error bells please | |
set shell=bash | |
set fileformats=unix | |
set ff=unix | |
set cursorline " highlight current line | |
filetype on " enable filetype detection | |
filetype indent on " enable filetype-specific indenting | |
filetype plugin on " enable filetype-specific plugins | |
set wildmode=longest:full | |
set wildmenu " menu has tab completion; visual autocomplete for command menu | |
"set laststatus=2 | |
hi Comment ctermfg=DarkGreen " comments color to dark green | |
" searching | |
set incsearch " incremental search; search as characters are entered | |
"set ignorecase " search ignoring case | |
set hlsearch " highlight the search matches | |
set showmatch " show matching bracket; highlight matching [{()}] | |
set diffopt=filler,iwhite " ignore all whitespace and sync | |
" folding | |
set foldenable " enable folding | |
set foldlevelstart=10 " open most folds by default | |
set foldnestmax=10 " 10 nested fold max | |
set foldmethod=indent " fold based on indent level; other options - [marker, manual, expr, syntax, diff]; run :help foldmethod for help | |
" splitting | |
set splitright " to make vsplit put the new buffer on the right if the current buffer | |
set splitbelow " to make split put the new buffer below the current buffer | |
" backup | |
set backup | |
set backupdir=~/.vim/backup | |
set directory=~/.vim/tmp | |
set viminfo=%100,'100,/100,h,\"500,:100,n~/.viminfo | |
set viminfo='100,f1 | |
" handling .ejs filetype | |
au BufNewFile,BufRead *.ejs set filetype=html.js | |
" handling .py filetype | |
autocmd Filetype python setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab | |
" configure jelera/vim-javascript-syntax | |
"au FileType javascript call JavaScriptFold() | |
" configure bling/vim-airline | |
set laststatus=2 | |
let g:airline_theme='luna' | |
if !exists('g:airline_symbols') | |
let g:airline_symbols={} | |
endif | |
let g:airline_left_sep='»' | |
let g:airline_left_sep='▶' | |
let g:airline_right_sep='«' | |
let g:airline_right_sep='◀' | |
let g:airline_symbols.linenr='␊' | |
let g:airline_symbols.linenr='' | |
let g:airline_symbols.linenr='¶' | |
let g:airline_symbols.branch='⎇' | |
let g:airline_symbols.paste='ρ' | |
let g:airline_symbols.paste='Þ' | |
let g:airline_symbols.paste='∥' | |
let g:airline_symbols.whitespace='Ξ' | |
" configure Yggdroot/indentLine | |
"let g:indentLine_color_term=0 | |
let g:indentLine_color_term=239 | |
let g:indentLine_color_gui='#09AA08' | |
let g:indentLine_char='│' | |
" nerdtree - treeview for folder structure | |
" autopen NERDTree and focus cursor in new document when vim opens | |
"autocmd VimEnter * NERDTree | |
"autocmd VimEnter * wincmd p | |
" toggle nerdtree open / close with ctrl+n | |
map <C-n> :NERDTreeToggle<CR> | |
let NERDTreeIgnore=['\.pyc$','\.o$'] | |
" ctrlp - quickly search and open files in vim | |
let g:ctrlp_cache_dir=$HOME . '/.cache/ctrlp' | |
if executable('ag') | |
let g:ctrlp_user_command='ag %s -l --nocolor -g ""' | |
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
cd ~ | |
# To fix the alt+tab issue | |
#sudo apt-get install --assume-yes compizconfig-settings-manager compiz-plugins | |
# The Silver Searcher - better grep - http://geoff.greer.fm/ag/ | |
sudo apt-get install --assume-yes silversearcher-ag | |
# Transmission - command line bittorrent client | |
sudo apt-get install --assume-yes transmission-cli transmission-daemon transmission-common | |
# xmllint - command line xml parse / indent | |
sudo apt-get install --assume-yes libxml2-utils | |
# dos2unix | |
sudo apt-get install --assume-yes dos2unix | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
cd ~ | |
# Dependency Installation | |
sudo apt-get update | |
sleep 3 | |
sudo apt-get install --assume-yes vim wget curl unzip htop screen | |
sudo apt-get install --assume-yes git mercurial | |
sudo apt-get install --assume-yes python-dev python-pip python-setuptools python-software-properties | |
sleep 3 | |
# Configure screen | |
echo 'alias my_screen="screen -D -R -S my_screen"' | tee -a $HOME/.bashrc | |
wget https://gist.github.com/shobhitsinghal624/7192658/raw/.screenrc -O $HOME/.screenrc | |
sleep 3 | |
# Configure vim | |
echo 'alias vim="vim -O"' | tee -a $HOME/.bashrc | |
wget https://gist.github.com/shobhitsinghal624/7192658/raw/.vimrc -O $HOME/.vimrc | |
mkdir -p ~/.vim/backup ~/.vim/tmp ~/.vim/autoload ~/.vim/bundle | |
sleep 3 | |
# vundle - vim bundle / plugin manager | |
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
sleep 3 | |
# install vim plugins | |
vim +PluginInstall +qall | |
# Configure git | |
wget https://gist.github.com/shobhitsinghal624/7192658/raw/.gitconfig -O $HOME/.gitconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Updating ssh-agent socket environment.." | |
echo "Current value: $SSH_AUTH_SOCK" | |
export SSH_AUTH_SOCK=$(find /tmp/ssh-* -user `whoami` -name agent\* -printf '%T@ %p\n' 2>/dev/null | sort -k 1nr | sed 's/^[^ ]* //' | head -n 1) | |
if [ $? -gt 0 ]; then | |
echo "ERROR!" | |
exit $? | |
fi | |
echo "New value: $SSH_AUTH_SOCK" | |
echo "All done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment