Skip to content

Instantly share code, notes, and snippets.

@bootleq
bootleq / a-unite.vim
Created August 26, 2013 08:16
Test example for unite-session `save` function.
let SessionLoad = 1
if &cp | set nocp | endif
let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0
let v:this_session=expand("<sfile>:p")
silent only
cd ~/repository/dotfiles/vim-test
if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
let s:wipebuf = bufnr('%')
endif
set shortmess=aoO
set all&
set nocompatible
set runtimepath=
set rtp+=~/repository/delimitMate/
set backspace=indent,eol,start
let delimitMate_expand_cr = 1
@bootleq
bootleq / .zshrc
Created March 5, 2014 09:31
Currently in use messy zshrc
# References:
# GRML - https://github.com/grml/grml-etc-core
# zsh-users - https://github.com/zsh-users
[[ $ZDOTDIR == '' ]] && export ZDOTDIR=$HOME
if [[ $ZDOTDIR == '/etc/users/bootleq' && -f $ZDOTDIR/.vimrc ]]; then
alias vim="vim -u $ZDOTDIR/.vimrc"
fi
@bootleq
bootleq / .gitconfig
Created April 4, 2014 08:31
Currently in use messy ~/.gitconfig
[user]
name = bootleq
email = bootleq@gmail.com
[color]
ui = auto
; [help]
; format = web
module ActionController
class Metal
attr_internal :cached_content_for
end
module Caching
module Actions
def _save_fragment(name, options)
return unless caching_allowed?
@bootleq
bootleq / .zshrc
Created September 1, 2014 02:59
zsh function to restart Rails server (only support nginx server with passenger or unicorn_rails)
rtouch() {
emulate -L zsh
if [[ -d tmp ]]; then
if which passenger 2>&1 >/dev/null; then
touch tmp/restart.txt && echo 'file touched.'
elif which unicorn_rails 2>&1 >/dev/null; then
if [[ -r tmp/pids/unicorn.pid && -n $(ps h -p `cat tmp/pids/unicorn.pid` | tr -d ' ') ]]; then
kill -USR2 $(cat tmp/pids/unicorn.pid) && echo "process killed."
elif [[ -f config/unicorn.rb ]] && [[ -n $RAILS_ENV ]]; then
bundle exec unicorn_rails -D -E $RAILS_ENV -c config/unicorn.rb && echo "process started."
@bootleq
bootleq / quickrun-as-sql-client.vim
Created June 12, 2015 08:30
Use vim-quickrun as SQL client
" First, install thinca/vim-quickrun
"
" https://github.com/thinca/vim-quickrun
"
" Then write some vimrc:
"
@bootleq
bootleq / .zshrc
Last active August 29, 2015 14:27
Find ssh-agent and do ssh-add if needed
sshAgentFind() {
# Ref https://github.com/wwalker/ssh-find-agent
local -a sockets
if [[ -z "$SSH_AUTH_SOCK" ]] ; then
sockets=("${(@f)$(find /tmp/ -type s -path '/tmp/ssh-*/agent.*' -user $USER)}")
for socket in $sockets; do
SSH_AUTH_SOCK=$socket ssh-add -l 2> /dev/null > /dev/null
if [[ $? -eq 0 ]]; then
export SSH_AUTH_SOCK=$socket
@bootleq
bootleq / upgrade_git.sh
Created September 15, 2015 12:08
Install git from source
#!/bin/bash
if which apt-get 2>&1 >/dev/null; then
sudo apt-get install -y libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
fi
cd ~/src
[[ ! -d git ]] && git clone https://github.com/git/git --depth 10
@bootleq
bootleq / upgrade_tig.sh
Created October 4, 2015 05:52
Install tig from source
#!/bin/bash
if which apt-get 2>&1 >/dev/null; then
[[ -z $(dpkg --get-selections | grep libncursesw5-dev) ]] && sudo apt-get install -y libncursesw5-dev
elif which brew 2>&1 >/dev/null; then
brew install tig --with-docs
exit
fi