Skip to content

Instantly share code, notes, and snippets.

@mbailey
mbailey / gist:1102495
Created July 24, 2011 10:43
you must be exhausted
Date: Tue, 12 Jul 2011 04:51:38 -0700 (PDT)
From: Cornelius special pal <youareasneakymofo-dodgy@yahoo.com.au>
Subject: Re: LDH - Lost Dogs Home new operations manager (2IC)
To: Mike Bailey <mike@bailey.net.au>
Oh I shall keep in touch, particularly if I would like to see inaction. I mean, wow, two whole blogs in 6 months. That is quite an effort. You must be exhausted
@mbailey
mbailey / gist:1102470
Created July 24, 2011 09:59
Email from anonymous containing dubious claims
Date: Sat, 9 Jul 2011 22:17:40 -0700 (PDT)
From: Cornelius special pal <youareasneakymofo-dodgy@yahoo.com.au>
Subject: LDH - Lost Dogs Home new operations manager (2IC)
To: mike@bailey.net.au
Hi Mike,
You don't know me, but your research skills are unsurpassed. I thought you might like a kick start to the new appointment at LDH. this is all in the public domain.
Things you should know about the new LDH "Vet" Mauricio Santos Bauer.
@mbailey
mbailey / gist:1086308
Created July 16, 2011 12:31
cap deprec:db:backup
[mbailey@island gs (master)]$ cap deprec:db:backup
triggering load callbacks
* executing `deprec:connect_canonical_tasks'
triggering start callbacks for `deprec:mysql:backup'
* executing `multistage:ensure'
*** Defaulting to `uat'
* executing `uat'
* executing `deprec:mysql:backup'
* executing "cd /srv/gemstalker/current && RAILS_ENV=production bundle exec rake deprec:db:backup"
servers: ["uat.int.failmode.com"]
@mbailey
mbailey / gist:1047509
Created June 26, 2011 10:53
deprec allows you to choose preferred services
# deprec defines some generic recipes for common services
# including ruby interpreter, web, app and database servers
#
# They default to my current favourites which you can override
#
# Service options
CHOICES_RUBY_VM = [:mri, :ree]
CHOICES_WEBSERVER = [:apache, :none]
CHOICES_APPSERVER = [:passenger, :none]
CHOICES_DATABASE = [:mysql, :postgresql, :sqlite, :none]
@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
@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 / 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
## 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)
class PostController < ApplicationController
respond_to :json, :html, :jpg, :xml
def index
respond_with(@posts = Post.all),
:methods => [:average_rating],
:include => :comments
end
def show
@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