start new:
tmux
start new with session name:
tmux new -s myname
" .vimrc | |
" load up pathogen and all bundles | |
syntax on " show syntax highlighting | |
filetype plugin indent on | |
set autoindent " set auto indent | |
set ts=2 " set indent to 2 spaces | |
set shiftwidth=2 | |
set expandtab " use spaces, not tab characters |
########################### | |
# Configuration | |
########################### | |
# use 256 term for pretty colors | |
set -g default-terminal "screen-256color" | |
# increase scroll-back history | |
set -g history-limit 5000 |
set -g prefix C-a # Make C-a the prefix instead of default | |
bind C-a send-prefix # Send to application | |
unbind C-b # Unbind C-b | |
set -sg escape-time 1 # Remove delay for keystrokes | |
setw -g mode-keys vi # Use vi mode | |
### Mouse mode ### | |
setw -g mode-mouse on # Toggle mouse mode globally | |
set -g mouse-select-pane on # Select pane using mouse |
# MySQL. Versions 4.1 and 5.0 are recommended. | |
# | |
# Install the MySQL driver: | |
# gem install mysql2 | |
# | |
# And be sure to use new-style password hashing: | |
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html | |
development: | |
adapter: mysql2 | |
encoding: utf8 |
"&&" and "||" in ruby statements (not if-stmts): | |
stmt1 && stmt2 | |
returns the first falsey result, or if no falsey's found, returns the last truthy result | |
ex: | |
'hello' && 'bye' | |
=> 'bye' | |
'hello' && false | |
=> false | |
false && 'hello' |
## Like a Symbol#to_proc but for array | |
class Array | |
def to_proc | |
lambda {|object| | |
self.map{|symbol| object.send(symbol.to_sym)} | |
} | |
end | |
end | |
#!/usr/bin/env ruby | |
#require 'rubygems' | |
#require 'pry' | |
#require 'pp' | |
# This scripts returns a list of MAC addresses. | |
# Usage: | |
# ./$0 LIMIT START END | |
# ./genmac.rb 5 00:50:56:00:00:00 00:50:56:3F:FF:FF | |
# |
class Array | |
def aghyad_quick_sort | |
return self if length <= 1 | |
pivot = self[length/2] | |
return find_all { |i| i < pivot }.quick_sort + find_all { |i| i == pivot } + find_all { |i| i > pivot }.quick_sort |