Skip to content

Instantly share code, notes, and snippets.

View someara's full-sized avatar

Sean OMeara someara

View GitHub Profile
unless ::File.exists('/asdljasdljkasdlkajsd') do
file "/tmp/hello" do
content "hi there\n"
end
end
vs
file "/tmp/hello" do
content "hi there\n"
derpy:~$ gem install vagrant
Building native extensions. This could take a while...
ERROR: Error installing vagrant:
ERROR: Failed to build gem native extension.
/Users/someara/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for re.h... no
checking for ruby/st.h... yes
creating Makefile
derpy:~$ ssh [email protected]
Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-29-virtual i686)
* Documentation: https://help.ubuntu.com/
System information as of Mon Sep 24 21:23:53 UTC 2012
System load: 0.01 Processes: 66
Usage of /: 9.0% of 9.99GB Users logged in: 1
Memory usage: 14% IP address for eth0: 10.152.151.236
# a recipe is a unit of intent.
include_recipe "custom_app::torrent_thefile"
# testing for a condition it the compile phase...
# the is not normally necessary.
unless File.dirname(node['custom_app']['thefile']).exists?
include_recipe "custom_app::server"
end
begin
require 'nokogiri'
rescue LoadError
Chef::Log.warn("Libraries in the SMF cookbook depend on chef_gem 'nokogiri'. Please include_recipe 'smf::default' before attempting to use them.")
end
@someara
someara / gist:3229740
Created August 1, 2012 18:49
pkgin return status fail
[root@393b16b ~]# pkgin -y install lkajsdlkajsd ; echo $?
lkajsdlkajsd is not available on the repository
calculating dependencies... done.
nothing to do.
0
@someara
someara / gist:3190137
Created July 27, 2012 19:47
solaris omnibus missing popt
[root@0f5d206 ~]# wget http://s3.amazonaws.com/opscode-full-stack/solaris2-5.11-i86pc/chef-full-0.10.8-3-solaris2-5.11-i86pc.tar.gz
--2012-07-27 19:29:38-- http://s3.amazonaws.com/opscode-full-stack/solaris2-5.11-i86pc/chef-full-0.10.8-3-solaris2-5.11-i86pc.tar.gz
Resolving s3.amazonaws.com (s3.amazonaws.com)... 207.171.163.151
Connecting to s3.amazonaws.com (s3.amazonaws.com)|207.171.163.151|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 24622816 (23M) [application/octet-stream]
Saving to: `chef-full-0.10.8-3-solaris2-5.11-i86pc.tar.gz'
100%[==========================================================================================================================================>] 24,622,816 4.25M/s in 5.5s
zaphod:~/work/sean.io$ for i in `knife joyent server list | grep running | awk '{ print $1 }'` ; do knife joyent server delete $i ; done
Stopped server: cddb17fc-0a80-462b-ba00-ae192343712d
Deleted server: cddb17fc-0a80-462b-ba00-ae192343712d
Stopped server: 6a72d486-bb15-410c-a8e4-73f2915ec25b
Deleted server: 6a72d486-bb15-410c-a8e4-73f2915ec25b
Stopped server: 2e7a4e41-abe4-49db-8c40-ba189d7791ae
Deleted server: 2e7a4e41-abe4-49db-8c40-ba189d7791ae
Stopped server: 8bc9a177-1fc4-456d-b507-163f25dfa70c
Deleted server: 8bc9a177-1fc4-456d-b507-163f25dfa70c
Stopped server: aa6754b0-66e1-4e6a-a087-2e30d22ec85e
# boolean checks
function if_mounted() {
local mount_point="$1"
local device="$2"
mount | grep "^`printf '%q' "${mount_point}"`" | awk '{ print $3 }' | grep "`printf '%q' "${device}"`" 2>&1>/dev/null
}
function if_lofi_associated(){
local block_image="$1"
lofiadm | grep "`printf '%q' ${block_image}`" | awk '{ print $2 }' | grep "^${block_image}$" 2>&1>/dev/null