First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel
Then ssh with root account, run this in termianl:
$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash| require 'rubygems' | |
| require 'simplegeo' # gem install sg-ruby | |
| require 'nokogiri' # gem install nokogiri | |
| require 'typhoeus' # gem install typhoeus | |
| require 'sinatra' # gem install sinatra | |
| ## | |
| # About: | |
| # This little script, sacca.rb allows you to save a gowalla user's checkins to a layer on SimpleGeo. | |
| # it's using PubSubHubbub (Gowalla's hub is at http://hub.gowalla.com/) to subscribe to the Atom feed |
| # Rake task to launch multiple Resque workers in development/production with simple management included | |
| require 'resque/tasks' # Require Resque tasks | |
| namespace :workers do | |
| # = $ rake workers:start | |
| # | |
| # Launch multiple Resque workers with the Rails environment loaded, | |
| # so they have access to your models, etc. |
| # Create 4 volumes and attach them to hdb | |
| %w[sdi sdj sdk sdl].each do |dev| | |
| volume = AWS.volumes.new :device => "/dev/#{dev}", :size => 5, :availability_zone => hdb.availability_zone | |
| volume.server = hdb | |
| volume.save | |
| end |
| after "deploy:symlink", "deploy:restart_workers" | |
| ## | |
| # Rake helper task. | |
| # http://pastie.org/255489 | |
| # http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/ | |
| # http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/ | |
| def run_remote_rake(rake_cmd) | |
| rake_args = ENV['RAKE_ARGS'].to_s.split(',') | |
| cmd = "cd #{fetch(:latest_release)} && #{fetch(:rake, "rake")} RAILS_ENV=#{fetch(:rails_env, "production")} #{rake_cmd}" |
| module BinaryTree | |
| class Node | |
| attr_reader :word, :count, :left, :right | |
| include Enumerable | |
| def initialize(word) | |
| @word, @count = word, 1 | |
| end |
| preferred_syntax = :sass | |
| http_path = '/' | |
| css_dir = 'assets/stylesheets' | |
| sass_dir = 'assets/sass' | |
| images_dir = 'assets/images' | |
| javascripts_dir = 'assets/javascripts' | |
| relative_assets = true | |
| line_comments = true | |
| # output_style = :compressed |
| module Avatarable | |
| extend ActiveSupport::Concern | |
| GRAVATAR_IMAGE_BASE_URL = 'http://www.gravatar.com/avatar/' | |
| GRAVATAR_IMAGE_DEFAULT_SIZE = '32' | |
| DEFAULT_URL = 'http://your-awesome-domain.com/images/your-awesome-default-image.png' | |
| # Avatarable assumes the class (or other module) that includes this module has an email attribute | |
| # if the email attribute is named something other than email, use alias_attribute to map it to email | |
| # alias_attribute :email, :your_email_attribute |
| -- 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%' |