Skip to content

Instantly share code, notes, and snippets.

View someara's full-sized avatar

Sean OMeara someara

View GitHub Profile
@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
}
@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 / 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 / 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
package "httpd" do
action :install
end
service "httpd" do
action [:start, :enable]
end
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
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
@someara
someara / gist:2576713
Created May 2, 2012 14:00
SLES11 - Chef-0.10.8 - EL6 installer
bash -c '
(
echo "export PS1=\"\\\\H:\\\\w\\\\\\$ \"" >> /etc/profile
)
echo <%= @config[:chef_node_name] %> > /tmp/chef_node_name
PROPERHOSTNAME=`cat /tmp/chef_node_name | cut -d. -f1`
PROPERDNSDOMAINNAME=`cat /tmp/chef_node_name | sed s/^$PROPERHOSTNAME.//`
bash -c '
(
echo "export PS1=\"\\\\H:\\\\w\\\\\\$ \"" >> /etc/profile
)
echo <%= @config[:chef_node_name] %> > /tmp/chef_node_name
PROPERHOSTNAME=`cat /tmp/chef_node_name | cut -d. -f1`
PROPERDNSDOMAINNAME=`cat /tmp/chef_node_name | sed s/^$PROPERHOSTNAME.//`
@someara
someara / gist:2010366
Created March 10, 2012 05:34
turn off chef-client verbose logging
execute "turn off chef-client verbose logging" do
command "echo 'verbose_logging false' >> /etc/chef/client.rb"
not_if "grep 'verbose_logging false' /etc/chef/client.rb"
end