Skip to content

Instantly share code, notes, and snippets.

View someara's full-sized avatar

Sean OMeara someara

View GitHub Profile
zaphod:~$ grep joyent ~/.chef/knife.rb
knife[:joyent_username] = "someara"
knife[:joyent_password] = "mahpasswordhere"
knife[:joyent_api_url] = "https://us-sw-1.api.joyentcloud.com/"
zaphod:~$ knife joyent server list
ERROR: ArgumentError: Joyent is not a recognized compute provider
zaphod:~$ time knife joyent server create --image 47e6af92-daf0-11e0-ac11-473ca1173ab0 --flavor "regular_128" --name "smartos-2"
Created machine: 5d989f72-b3bc-44a1-816d-1d6d0e969b57
real 0m24.673s
user 0m2.179s
sys 0m0.533s
zaphod:~$ time knife joyent server create --image 47e6af92-daf0-11e0-ac11-473ca1173ab0 --flavor "regular_128"
Created machine: 09061a38-6916-4be8-b993-efb70f3f0f3b
real 0m28.115s
package "httpd" do
action :install
end
service "httpd" do
action [:start, :enable]
end
@someara
someara / custom.erb
Created June 17, 2012 19:59 — forked from adamhjk/custom.erb
Apache virtualhost file
<% if @port != 80 -%>
Listen <%= @port %>
<% end -%>
<VirtualHost *:<%= @port %>>
ServerAdmin webmaster@localhost
DocumentRoot <%= @document_root %>
<Directory />
Options FollowSymLinks
@someara
someara / default.rb
Created June 19, 2012 03:41 — forked from adamhjk/default.rb
Re-factored Apache cookbook
#
# Cookbook Name:: apache
# Recipe:: default
#
# Copyright 2012, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
package "httpd" do
@someara
someara / gist:3145376
Created July 19, 2012 17:08
append_if_no_such_line
function append_if_no_such_line() {
local line="$1";
local file="$2";
if ! grep "^`printf '%q' "$line"`$" $file 2>&1>/dev/null ; then echo "$line" >> $file ; fi
}
@someara
someara / gist:3148184
Created July 20, 2012 01:56
check_if_mounted
function check_if_mounted() {
local mount_point="$1"
local device="$2"
mount | grep "^`printf "$mount_point"`" | awk '{ print $3 }' | grep "`printf "$device"`" 2>&1>/dev/null
}
# 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
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
@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