start new:
tmux
start new with session name:
tmux new -s myname
| # This is just a cheat sheet: | |
| # On production | |
| sudo -u postgres pg_dump database | gzip -9 > database.sql.gz | |
| # On local | |
| scp -C production:~/database.sql.gz | |
| dropdb database && createdb database | |
| gunzip < database.sql.gz | psql database |
| def resize_nocrop_noscale(image, w,h) | |
| w_original = image[:width].to_f | |
| h_original = image[:height].to_f | |
| if w_original < w && h_original < h | |
| return image | |
| end | |
| # resize | |
| image.resize("#{w}x#{h}") |
| -- Create a group | |
| CREATE ROLE readaccess; | |
| -- Grant access to existing tables | |
| GRANT USAGE ON SCHEMA public TO readaccess; | |
| GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess; | |
| -- Grant access to future tables | |
| ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess; |
| -- 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%' |
| #!/usr/bin/env ruby | |
| require 'english' | |
| require 'rubocop' | |
| ADDED_OR_MODIFIED = /A|AM|^M/.freeze | |
| changed_files = `git status --porcelain`.split(/\n/). | |
| select { |file_name_with_status| | |
| file_name_with_status =~ ADDED_OR_MODIFIED |
| " ============================================================================= | |
| " Miller Medeiros .vimrc file | |
| " ----------------------------------------------------------------------------- | |
| " heavily inspired by: @factorylabs, @scrooloose, @nvie, @gf3, @bit-theory. | |
| " ============================================================================= | |
| " ----------------------------------------------------------------------------- | |
| " BEHAVIOR | |
| " ----------------------------------------------------------------------------- |
| ### Step 1: Install xvfb | |
| > # apt-get install xvfb | |
| ### Step 2: Create and enable the init script for the xvfb daemon | |
| Note “:0″ in XVFBARGS which sets to display 0, and the –set-guid parameter, which runs the daemon as the www-data user. If you are not running a headless server, make sure to change all references to “:0″ to “:#” (ie: :1, :2 or :22) to avoid conflicts with your existing X session(s) | |
| Move xvfb_v2 to in “/etc/init.d/xvfb”: |