most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat
" Switch wrap off for everything | |
set nowrap | |
if has("autocmd") | |
" This is probably in your .vimrc already. No need to duplicate! | |
filetype plugin indent on | |
" Set File type to 'text' for files ending in .txt | |
autocmd BufNewFile,BufRead *.txt setfiletype text |
# 0 is too far from ` ;) | |
set -g base-index 1 | |
# Automatically set window title | |
set-window-option -g automatic-rename on | |
set-option -g set-titles on | |
#set -g default-terminal screen-256color | |
set -g status-keys vi | |
set -g history-limit 10000 |
module TransactionalFixtureDisabler | |
def self.included(klass) | |
klass.teardown :restore_transactional_fixture_status | |
end | |
# call this at the top of your test if you need to disable | |
# transactional fixtures. this might be the case if: | |
# - you're testing after_commit or after_rollback callbacks | |
# on models |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
require "bundler/capistrano" | |
namespace :db do | |
require 'yaml' | |
desc "Copy the remote production database to the local development database NOTE: postgreSQL specific" | |
task :pg_backup_production, :roles => :db, :only => { :primary => true } do | |
# First lets get the remote database config file so that we can read in the database settings | |
tmp_db_yml = "tmp/database.yml" | |
get("#{shared_path}/config/database.yml", tmp_db_yml) |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
(Note: This assumes you've already configured your master server for streaming replication)
export DATADIR=/data/postgres-9.3
export MASTER=192.168.0.1
export REPL_USER=replication
export REPL_PASSWORD=mypassword
Create a base backup:
CREATE EXTENSION btree_gist; | |
CREATE TABLE room_reservations ( | |
room_id integer, | |
reserved_at timestamptz, | |
reserved_until timestamptz, | |
canceled boolean DEFAULT false, | |
EXCLUDE USING gist ( | |
room_id WITH =, tstzrange(reserved_at, reserved_until) WITH && | |
) WHERE (not canceled) |