Skip to content

Instantly share code, notes, and snippets.

View tjl2's full-sized avatar

Tim Littlemore tjl2

  • DICE
  • Cheshire, UK
  • 14:02 (UTC +01:00)
View GitHub Profile
acl url_checkout path_beg /checkout
use_backend app_master if url_checkout
@tjl2
tjl2 / default.rb
Created November 22, 2012 08:53
Resque recipe
#
# Cookbook Name:: resque
# Recipe:: default
# We don't want this to be setup on the master app/db slice
if ['solo', 'util'].include?(node[:instance_role])
execute "install resque gem" do
command "gem install resque redis redis-namespace yajl-ruby -r"
not_if { "gem list | grep resque" }
check process nrsysmond
with pidfile /tmp/nrsysmond.pid
start program = "/etc/init.d/newrelic-sysmond start"
stop program = "/etc/init.d/newrelic-sysmond stop"
group newrelic
@tjl2
tjl2 / default.rb
Created July 6, 2012 08:45
cookbooks/nginx_rewrites/recipes/default.rb
app_name = 'Networker'
service "nginx" do
supports :reload => true
action :enable
end
if ['solo', 'app', 'app_master'].include?(node[:instance_role])
remote_file "/etc/nginx/servers/#{app_name}/custom.conf" do
source "custom.conf"
@tjl2
tjl2 / default.rb
Created July 4, 2012 09:34
swapfile recipe
swapfile = '/mnt/swapfile'
execute "create swapfile" do
command %Q{ dd if=/dev/zero of=#{swapfile} bs=1M count=1024 && \
sudo mkswap #{swapfile} && \
sudo swapon #{swapfile} }
not_if { File.exists? swapfile }
end
for PID in $(cat output.txt | grep PID | awk '{print $3}'); do
URL=$(cat output.txt| grep $PID -A 1 | tail -n 1| awk '{print $3}')
PASSWD=$(cat output.txt|grep $PID -A 2 | tail -n 1|awk '{print $2}')
echo "$PID $URL $PASSWD"
done
@tjl2
tjl2 / default.rb
Created June 14, 2012 07:36
Chef recipe - Resque running on EY Cloud util instance
#
# Cookbook Name:: resque
# Recipe:: default
# We don't want this to be setup on the master app/db slice
if ['solo', 'util'].include?(node[:instance_role])
execute "install resque gem" do
command "gem install resque redis redis-namespace yajl-ruby -r"
not_if { "gem list | grep resque" }
⚡ irb
1.9.3p125 :001 > ['adam', 'jim', 'tim'].sample
=> "tim"
1.9.3p125 :002 > ['adam', 'jim', 'tim'].sample
=> "tim"
1.9.3p125 :003 > ['adam', 'jim', 'tim'].sample
=> "jim"
1.9.3p125 :004 > ['adam', 'jim', 'tim'].sample
=> "jim"
1.9.3p125 :005 > ['adam', 'jim', 'tim'].sample
Tim@MacBookPro15 /Users/Tim (ruby-1.8.7-p357)
⚡ rvm get head
Original installed RVM version:
rvm 1.10.2-pre by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.beginrescueend.com/]
remote: Counting objects: 44, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 30 (delta 20), reused 24 (delta 14)
Tim@MacBookPro15 /Users/Tim (ruby-1.8.7-p357)
⚡ rvm list
rvm rubies
rbx-head [ x86_64 ]
=* ruby-1.8.7-p357 [ i686 ]
ruby-1.9.2-p290 [ x86_64 ]
ruby-1.9.3-p0 [ x86_64 ]
ruby-1.9.3-rc1 [ x86_64 ]