Skip to content

Instantly share code, notes, and snippets.

# you'd obviously have more settings somewhere
set :scm, :git
set :repository, "git@github.com:defunkt/github.git"
set :branch, "origin/master"
set :migrate_target, :current
set(:latest_release) { fetch(:current_path) }
set(:release_path) { fetch(:current_path) }
set(:current_release) { fetch(:current_path) }
#!/usr/bin/env ruby
def parse_missing_required(input)
matches = input.match(/Missing these required gems:([\s\S]*)You're running:/)
matches[1].strip.split("\n").map do |line|
m = line.match(/^\s*(\S+)\s+(\S+\s+[0-9.]+)/)
p line if m.nil?
{:name => m[1], :version => m[2]}
end
end
# scenario:
# - you work from a dev account that has git authentication with keys in place
# - you use a sudoer account (first_user) to ssh and run chef on a server
# - the chef recipes deploy an application under a second_user
# - first_user and second_user don't have git keys in place and you want to use forwarding
# initial run (bootstrapping maybe)
include_recipe 'helper'
var HOSTNAME: 'localhost'
, SHARE_SWF: '/client/DeskshareStandalone.swf'
, INSTALL_SWF: '/expressInstall.swf'
, ARCHIVE: "/client/bbb-deskshare-applet-0.71.jar"
, CODE: "org.bigbluebutton.deskshare.client.DeskShareApplet.class"
, SWF_ID: "screen_viewer"
, VIEWER_WIDTH: 800
, VIEWER_HEIGHT: 600
, ROOM_NUMBER: 1;
# In example.rb
module My
module Example
extend self
# This method does something
def command1(arg1, arg2, options = {})
end
# This method does something else
@hedgehog
hedgehog / app.rb
Created May 1, 2011 21:11 — forked from andyl/app.rb
def run_in_background(&block)
Process.fork do
Process.fork do
puts "Launching Background Process"
Daemons.call &block
puts "Background Process has been Launched"
end
exit
end
end
@hedgehog
hedgehog / definition.rb
Created May 4, 2011 01:10 — forked from schisamo/definition.rb
veewee definition for creating a Vagrant box that mirrors the ubuntu10.04-gems knife bootstrap template
Veewee::Session.declare( {
:cpu_count => '1',
:memory_size=> '256',
:disk_size => '10140',
:disk_format => 'VDI',
:disk_size => '10240' ,
:os_type_id => 'Ubuntu',
:iso_file => "ubuntu-10.04.1-server-i386.iso",
:iso_src => "http://releases.ubuntu.com/10.04.1/ubuntu-10.04.1-server-i386.iso",
:iso_md5 => "01f72c846845e4e19aec8a45912e5dda",
@hedgehog
hedgehog / definition.rb
Created May 4, 2011 01:11 — forked from schisamo/definition.rb
veewee definition for creating a Vagrant box that mirrors the centos5-gems knife bootstrap template
Veewee::Session.declare( {
:cpu_count => '1',
:memory_size=> '384',
:disk_size => '10140',
:disk_format => 'VDI',
:disk_size => '10240' ,
:os_type_id => 'RedHat',
:iso_file => "CentOS-5.5-i386-netinstall.iso",
:iso_src => "http://mirror.bytemark.co.uk/centos/5.5/isos/i386/CentOS-5.5-i386-netinstall.iso",
:iso_md5 => "0172883a3039772165db073693debae5",
Vagrant::Config.run do |global_config|
aptdir = (ENV['APTCACHE'] or "#{ENV['HOME']}/aptcache/")
checkout = (ENV['COOKBOOKS'] or "#{ENV['HOME']}/openstack-cookbooks")
ip_prefix = (ENV['IP_PREFIX'] or "192.168.76.")
mac_prefix = (ENV['MAC_PREFIX'] or "080027076")
fixed = (ENV['FIXED'] or "10.0.76.0/24")
global_config.vm.define :chef do |config|
suffix = "100"
ip = "#{ip_prefix}#{suffix}"
config.vm.box = "base"
@hedgehog
hedgehog / apps.rb
Created May 18, 2011 23:51 — forked from nesquena/apps.rb
Padrino session snippet
# config/apps.rb
Padrino.configure_apps do
enable :sessions
# $ padrino rake gen
# $ rake secret
set :session_secret, "long secret key pasted here"
end