Skip to content

Instantly share code, notes, and snippets.

require 'deprec'
# deploy.rb for installing tracks
#
# http://github.com/bsag/tracks/tree/master
#
# This file demonstrates how simple deprec-2.0.0 can make installing a Rails app.
#
# If you want to use Passenger, Ruby Enterprise Edition and Apache, simple update
# the value for :domain below and you're ready to deploy.
# install_chef_server.sh
#
# From list post by John Merrells <john@merrells.com>
# Modified by Mike Bailey <mike@bailey.net.au>
logfile="/root/log.txt"
echo "-----" >> $logfile
# New sources.list
cat > /etc/apt/sources.list << EOF
# config/initializers/fingerprint.rb # XXX Breaks Rails asset bundling
#
# Mike Bailey <mike@bailey.net.au>
#
# Updates Rails Helpers to use fingerprint in path instead of timestamp in query string.
#
# Add the following to your Apache config to remove the fingerprints:
#
# # Remove fingerprints
# RewriteEngine On
Domain.blueprint do
name { "domain#{sn}" }
primary_ns { "4.2.2.1" }
contact { "contact name" }
serial { "#{sn}" }
refresh { 120 }
retry { 120 }
expire { 120 }
minimum { 120 }
end
@mbailey
mbailey / tail.rb
Created October 25, 2010 06:00
tail.rb
#!/usr/bin/env ruby
filename = ARGV[0]
end_marker = 0
offset_increment = 1000
lines = []
fh = File.open filename
while lines.size < 10
class PostController < ApplicationController
respond_to :json, :html, :jpg, :xml
def index
respond_with(@posts = Post.all),
:methods => [:average_rating],
:include => :comments
end
def show
## Encode
json = ActiveSupport::JSON.encode(object) # extra methods like :include
json = Offering.first.to_json(:include => :outlet, :methods => [:days_waiting])
## Decode
ActiveSupport::JSON.decode(json)
@mbailey
mbailey / VMware vCenter Convertor Standalone SLOWNESS
Created March 15, 2011 06:03
I'm attempting to use VMware vCenter Converter Standalone to migrate a 10GB Ubuntu guest from an ESXi 4.0.0 host to an ESXi 4.1.0 host. After running for two hours and reporting only 3% progress the conversion failed. The converter logs are below.
Section for VMware vCenter Converter Standalone, pid=2596, version=4.3.0, build=build-292238, option=Release
[2011-02-24 14:41:11.109 03884 warning 'App'] Failed to create console writer
[2011-02-24 14:41:11.249 02808 info 'App'] Current working directory: C:\Program Files\VMware\VMware vCenter Converter Standalone
[2011-02-24 14:41:11.249 02808 info 'App'] Trying converter_server
[2011-02-24 14:41:12.374 02808 info 'App'] [shutdownMgr,25] Ufa shutdown manager registered.
[2011-02-24 14:41:12.374 02808 info 'App'] [helper,453] Initializing SSL Contexts
[2011-02-24 14:41:12.406 02808 info 'Libs'] Using system libcrypto, version 9080CF
[2011-02-24 14:41:13.671 02808 info 'App'] Vmacore::InitSSL: doVersionCheck = true, handshakeTimeoutUs = 120000000
[2011-02-24 14:41:13.671 02808 info 'App'] [helper,499] Initializing certificates
[2011-02-24 14:41:13.671 02808 info 'App'] [task,2061] [LRO] 32 max LROs
@mbailey
mbailey / blinksave.rb
Created May 26, 2011 14:27
Download all your blinksale invoices as PDFs
#!/usr/bin/env ruby
require 'rubygems'
require 'highline/import'
require 'mechanize'
require 'uri'
# Get details
domain = ask("your blinksale domain prefix") + '.blinksale.com'
login_page_url = "https://#{domain}/sessions/new"
@mbailey
mbailey / gist:1047508
Created June 26, 2011 10:51
deprec recipe to install rails stack
desc "Install Rack stack on Ubuntu server (8.04, 10.04)"
task :install_stack do
top.deprec.git.install
top.deprec.ruby.install # Uses ruby_vm_type
top.deprec.web.install # Uses web_server_type
top.deprec.app.install # Uses app_server_type
top.deprec.rails.install
top.deprec.logrotate.install
# top.deprec.monit.install # Not using monit lately
end