This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
#! /usr/bin/env python | |
from boto.ses.connection import SESConnection | |
import os | |
import sys | |
import subprocess | |
import socket | |
TMPFILE = '/var/run/postgresql/last-wal-archive-error-file.tmp' | |
if __name__ == '__main__': |
class TasksController < ApplicationController | |
def update | |
if @task.update_attributes(params[:task]) | |
tracker = PostSaveTaskTracker.new(@task) | |
TaskPusher.new(tracker, socket_id).push_changes | |
TaskMailSender.new(tracker, current_user).deliver_email | |
# success response | |
else | |
# failure respond | |
end |
class TasksController < ApplicationController | |
def update | |
if @task.update_attributes(params[:task]) | |
TaskPusher.new(@task, socket_id).push_changes | |
TaskMailSender.new(@task, current_user).deliver_email | |
# success response | |
else | |
# failure respond | |
end | |
end |
class TasksController < ApplicationController | |
def update | |
tracker = TaskTracker.new(@task) | |
if @task.update_attributes(params[:task]) | |
TaskPusher.new(tracker, socket_id).push_changes | |
TaskMailSender.new(tracker, current_user).deliver_email | |
# success response | |
else | |
# failure respond | |
end |
Create the appropriate VPC that your application is going to live in. Create subnets for each availability zone you want to use.
Create VPC security group(s) for your auto-scaling instances. For example, if you're going to auto-scale web servers, create a "web" VPC security group.
Go into AWS console and create an ELB. Easy wizard. Select HTTP and (if needed) HTTPS. Make sure it's associated with the VPC you created in step 1.
Create an auto-scaling launch configuration from the CLI. The launch configuration has the AMI, size, and security group from step #2. The security group must be by ID not name ("sg-12345"):
as-create-launch-config web --image-id ami-2e31bf1e --instance-type m1.medium \
-g sg-7619041a --key root
-- Index hit rate | |
WITH idx_hit_rate as ( | |
SELECT | |
relname as table_name, | |
n_live_tup, | |
round(100.0 * idx_scan / (seq_scan + idx_scan),2) as idx_hit_rate | |
FROM pg_stat_user_tables | |
ORDER BY n_live_tup DESC | |
), |
namespace :log do | |
desc "Downloads application logs to ./log/deploy/<RAILS_ENV>/<TIMESTAMP>/" | |
task :fetch, :roles => :app do | |
source = "#{shared_path}/log/#{rails_env}.log*" | |
files_per_host = {} | |
run "ls #{source}" do |channel, stream, data| | |
files_per_host[channel[:host]] = data.split("\n") | |
end | |
destination = File.join('log', 'deploy') |
#!/usr/bin/env bash | |
# Compress MySQL tables on disk. | |
# Author: Andrew Berry, [email protected] | |
# | |
# Compress all tables in a MySQL InnoDB database using compression from the | |
# Barracuda table format. Tables have to already be in the Barracuda file | |
# format to actually compress tables, otherwise the table setting is ignored. | |
# | |
# innodb_file_per_table = 1 MUST be set in my.cnf for compression to work. |
In one of my pet projects, I redirect all requests to index.php, which then decides what to do with it:
This snippet in your .htaccess will ensure that all requests for files and folders that does not exists will be redirected to index.php:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d