Skip to content

Instantly share code, notes, and snippets.

@reedlaw
reedlaw / chef_solo_bootstrap.sh
Created May 9, 2012 06:37 — forked from ryanb/chef_solo_bootstrap.sh
Bootstrap Chef Solo
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar xvzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194/
./configure --prefix=/usr/local
make
make install
@reedlaw
reedlaw / chef_solo_bootstrap.sh
Created May 11, 2012 06:16
Bootstrap Chef Solo
#!/usr/bin/env bash
apt-get install -y python-software-properties build-essential
apt-add-repository -y ppa:brightbox/ruby-ng
apt-get update
apt-get install -y ruby1.9.3
echo "gem: --no-ri --no-rdoc" >> ~/.gemrc
gem install chef
mkdir /etc/chef
cat <<EOF >/etc/chef/solo.rb
file_cache_path "/var/chef"
@reedlaw
reedlaw / chef_solo_bootstrap.sh
Created May 17, 2012 04:18
Chef solo bootstrap from private repo
#!/usr/bin/env bash
apt-get install -y python-software-properties build-essential
apt-add-repository -y ppa:brightbox/ruby-ng
apt-get update
apt-get install -y ruby1.9.3
echo "gem: --no-ri --no-rdoc" >> ~/.gemrc
gem install chef
mkdir /etc/chef /var/chef
cat <<EOF >/etc/chef/solo.rb
file_cache_path "/var/chef"
@reedlaw
reedlaw / ubuntu-latest-ruby-package.sh
Created May 24, 2012 01:31
Install latest ruby from Brightbox PPA on Ubunut
#!/usr/bin/env bash
apt-get install -y python-software-properties build-essential
apt-add-repository -y ppa:brightbox/ruby-ng
apt-get update
apt-get install -y ruby1.9.3
echo "gem: --no-ri --no-rdoc" >> ~/.gemrc
@reedlaw
reedlaw / development.log
Created July 13, 2012 00:29
ruote-mon logging messages
=> Booting Thin
=> Rails 3.2.5 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
MONGODB (244ms) ctdev['msgs'].find({}).limit(300).sort([["_id", 1]])
MONGODB (4ms) ctdev['schedules'].find({"at"=>{"$lte"=>"2012-07-13 00:26:44.081814 UTC"}})
MONGODB (0ms) ctdev['configurations'].find({"_id"=>"engine"}).limit(-1)
@reedlaw
reedlaw / record.sh
Created August 30, 2012 02:35
Record Screencast in Ubuntu
sleep 3; avconv -f x11grab -r 25 -s 1280x720 -i :0.0+0,50 -f alsa -i hw:2,0 -vcodec libx264 -preset ultrafast -acodec libmp3lame -threads 0 output.mkv
<a href='javascript:(function(){$("#user_first_name").val("John");$("#user_last_name").val("Doe");$("#user_address_1").val("123 Somewhere Ln.");$("#user_city").val("Someplace");$("#user_zip").val("12345");$("#user_phone").val("1-234-567-8901");rand=randomnumber=Math.floor(Math.random()*111111);$("#user_email").val("testing"+rand+"@example.com");$("#billingAddressInput").attr("checked","true");$("input[name=agreements]").attr("checked","true");$("#user_password").val("password");$("#user_password_confirmation").val("password");})();'>DGN Reg</a>
<a href="javascript:(function(){$(&quot;#order_card_name&quot;).val(&quot;John Doe&quot;);$(&quot;#order_card_number&quot;).val(&quot;4904202183894535&quot;);$(&quot;.selectMonth option:eq(3)&quot;).attr('selected','selected');$(&quot;.selectYear option:eq(3)&quot;).attr('selected','selected');$(&quot;.securityCode&quot;).val('123');})();">DGN CC#</a>
@reedlaw
reedlaw / entity.rb
Last active December 27, 2015 02:29
Entity model for entities to inherit
class Entity
include ActiveModel::Validations
attr_accessor :id
def self.attr_accessor(*vars)
@class_attributes ||= [:id]
@class_attributes.concat vars
super(*vars)
end
@reedlaw
reedlaw / interactor.rb
Created October 31, 2013 16:55
Interactor class for interactors to inherit
class Interactor
attr_reader :request, :response
def initialize(request = {})
@request = request
@response = Response.new
end
private
@reedlaw
reedlaw / request.rb
Created October 31, 2013 16:58
Request and response model
class Request < Hashie::Mash
def object_attributes
self[:object_attributes].to_hash.with_indifferent_access
end
end
class Response < Hashie::Mash
def persisted?
!id.nil?
end