View gist:4631070
action :sqlite3_gem do
begin
require 'sqlite3'
rescue LoadError
package "sqlite-devel" do
action :install
end
gem "sqlite3" do
action :install
View gist:4092734
#!/usr/bin/env ruby
require 'sqlite3'
db = SQLite3::Database.new( "test.db")
begin
db.query("SELECT * from dashboard_dashboard")
rescue
puts "dashboard_dashboard not found\nCreating table dashboard_dashboard\n"
db.execute("CREATE TABLE \"dashboard_dashboard\" (
\"name\" varchar(128) NOT NULL PRIMARY KEY,
\"state\" text NOT NULL);"
View gist:4083850
# LAX -> linode
[root@eblack-vagrant01 mtr-0.82]# mtr brofist.net --report-cycles 30 --report
HOST: eblack-vagrant01 Loss% Snt Last Avg Best Wrst StDev
1.|-- 10.0.2.2 0.0% 30 0.4 2.1 0.2 42.3 7.7
2.|-- 1-1-12-12.attalascom.net 0.0% 30 4.2 3.1 1.1 32.5 5.7
3.|-- cpe-76-173-0-1.socal.res. 0.0% 30 33.9 33.9 22.9 62.2 8.9
4.|-- tge7-1.wlvgcabn-cer02.soc 0.0% 30 17.6 15.5 11.5 32.5 5.0
5.|-- tge0-8-0-8.vnnycajz-ccr01 3.3% 30 23.5 27.4 18.5 78.6 13.1
6.|-- 72.129.13.0 0.0% 30 19.0 25.1 17.5 51.9 7.6
7.|-- 107.14.19.32 0.0% 30 21.6 24.3 16.7 52.7 7.0
View gist:4036273
action :start_stop do
begin
@new_resource.start_service(node[:service_status][:state])
rescue
Chef::Log.warn("----------")
Chef::Log.warn("Application default state is missing. Defaulting to start the service. If this cluster or service should not automatically start defined node[:service_status][:state]")
Chef::Log.warn("----------")
@new_resource.start_service("start")
@new_resource.env_state("start")
View gist:3747116
foo = node[:ntp][:test]
template "foo.conf" do
source "foo.conf.erb"
variables( :foobar => foo[:platform])
end
View gist:3128599
function prompt {
local bc="\[\e[0m\]"
local ob="\[\e[1;31m\][\]"
local cb="\[\e[1;31m\]]\]"
local spc="\[\e[0;32m\]"
local host="\[\e[30;34m\]\u@\h\]"
local lwd="\[\e[30;34m\]\w\]"
export PS1="$ob"$bc"$host"$bc"$cb"$bc"$spc:$ob"$bc"$lwd"$bc"$cb"$bc""$spc"$"$bc" "
}
prompt
View gist:2426971
# Up the kernel's SHMMAX
raisit = execute "raise_tha_roof" do
if ["t1.micro","c1.medium","m1.small"].include? node[:ec2][:instance_type] then
shmmax=1073741824
else
shmmax=17179869184
end
command "sysctl -w kernel.shmmax=#{shmmax}"
end
View gist:2381152
yum erase $(yum list installed | grep ruby | awk '{printf $1" "}' | sed -e 's/libselinux-ruby.x86_64//g' -e 's/\.x86_64//g') && cd /tmp ; curl -O http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz && tar xzf ruby-1.9.2-p290.tar.gz && cd ruby-1.9.2-p290 && ./configure && make && make install && gem i chef && wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm && rpm -i epel-release-6-5.noarch.rpm && mkdir /var/cache/chef ; mkdir /var/cache/chef/cookbooks
View gist:2347722
#!/usr/bin/env perl
# -*- perl -*-
# location of the server-side scp we want to run
$scp_server = "/usr/bin/scp";
sub fail {
my ($msg) = @_;
print STDERR $msg, "\n";
exit 1;
View gist:1796155
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Sample Amazon Linux x86_64 using CloudFormation",
"Parameters" : {
"KeyName" : {
"Description" : "some-key",
"Type" : "String"