Skip to content

Instantly share code, notes, and snippets.

View davidx's full-sized avatar
🌍

David Andersen davidx

🌍
View GitHub Profile
Feature: Setup my server
As an awesome rails coder
In order to host my rails application
I would like to have chef setup my server
Background
Given an ubuntu 9.04 server at slicehost
And my applications directory is /var/www/apps
Scenario: Setting up the server
# <fs> <mountpoint> <type> <opts> <dump/pass>
/dev/sda1 / ext3 noatime 0 0
proc /proc proc defaults 0 0
shm /dev/shm tmpfs nodev,nosuid,noexec 0 0
require 'rubygems'
require 'open-uri'
require 'yaml'
require 'mechanize'
ARCHIVE_PATH = '/tmp/images'
FileUtils.mkdir_p ARCHIVE_PATH
a = WWW::Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari'}
#!/usr/bin/ruby
#
# In your favorite programming language, write a program to read a multiple line text file and write the
# N longest lines to a new file. Where N and the file to be read are specified on the command line.
require 'rubygems'
require 'choice'
Choice.options do
header ''
client:
require 'rubygems'
require 'mq'
redis_command = ["INFO"].join("\r\n")
EM.run do
mq = MQ.new
q = mq.queue('vanity')
# i've tried varieties of rvm install in fail,
# also, I didnt think about not needing to run it as root.
# When you install it, you don't have to be root.
# this seems to work
# just copy and paste this bit:
RVM_GIT_REPO=git://github.com/wayneeseguin/rvm.git
mkdir -p $HOME/.rvm/src && cd $HOME/.rvm/src &&
[Sat, 24 Apr 2010 00:06:59 -0700] DEBUG: Ohai Attribute: languages - {"java"=>{"runtime"=>{"name"=>"Java(TM) SE Runtime Environment", "build"=>"1.6.0_17-b04-248-10M3025"}, "version"=>"1.6.0_17"}, "python"=>{"builddate"=>"Apr 23 2010, 16:15:07", "version"=>"2.6.4"}, "perl"=>{"archname"=>"darwin-2level", "version"=>"5.10.1"}, "ruby"=>{"gems_dir"=>"/Users/davidx/.rvm/gems/ruby-1.8.6-p399", "target_os"=>"darwin10.2.0", "platform"=>"i686-darwin10.2.0", "host_vendor"=>"apple", "bin_dir"=>"/Users/davidx/.rvm/rubies/ruby-1.8.6-p399/bin", "target_cpu"=>"i686", "target_vendor"=>"apple", "host_os"=>"darwin10.2.0", "ruby_bin"=>"/Users/davidx/.rvm/rubies/ruby-1.8.6-p399/bin/ruby", "version"=>"1.8.6", "host_cpu"=>"i686", "host"=>"i686-apple-darwin10.2.0", "release_date"=>"2010-02-05", "target"=>"i686-apple-darwin10.2.0"}, "erlang"=>{"options"=>["SMP", "ASYNC_THREADS", "HIPE"], "version"=>"5.7.2", "emulator"=>"BEAM"}}
[Sat, 24 Apr 2010 00:06:59 -0700] DEBUG: Platform is mac_os_x version 10.6.2
[Sat, 24 Apr 2010 00:06:59 -07
-extra/xfce4-systemload-plugin/xfce4-systemload-plugin-0.4.2-r1.ebuild
xfce-extra/xfce4-systemload-plugin/files/
xfce-extra/xfce4-systemload-plugin/files/xfce4-systemload-plugin-0.4.2-fix-tooltip-gtk2.12.patch
xfce-extra/xfce4-taskmanager/
xfce-extra/xfce4-volumed/
Number of files: 58389
Number of files transferred: 13085
Total file size: 96614304 bytes
Total transferred file size: 29271379 bytes
# very quick-n-dirty gemstack replicate. use chef when you can...
ssh -t myhostname "gem list" | sed -e 's/\,//g'| sed 's|)||g'| sed 's|(||g' | awk '{ print "gem install "$1" --version="$2" --no-ri --no-rdoc" }' |bash
cat /proc/partitions
db2 ~ # cat /proc/partitions
major minor #blocks name
8 0 71687372 sda
8 1 112423 sda1
8 2 530145 sda2
8 3 71039430 sda3
8 32 71687372 sdc
8 16 71687372 sdb