Skip to content

Instantly share code, notes, and snippets.

View mdkent's full-sized avatar

Matthew Kent mdkent

  • Basecamp
  • Nanaimo, BC, Canada
View GitHub Profile
(rdb:1) eval node.attribute[:foo][:bar] = "baz"
"baz"
(rdb:1) eval node.attribute[:foo].has_key?(:bar)
true
(rdb:1) eval node.attribute[:foo].delete(:bar)
"baz"
(rdb:1) eval node.attribute[:foo].has_key?(:bar)
false
@mdkent
mdkent / .zshrc
Created April 14, 2010 16:28 — forked from jtimberman/.zshrc
alias gitp="git log -p"
alias gitf="git log --pretty=format:'%Cgreen%ad %cn %Cblue%h %Creset%s' --date=short"
alias gitlog="git log --graph --pretty=format:'%an: %s - %Cred%h%Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
service_link 'apache' do
version [node[:apache][:version], node[:apache][:worker]].join('-')
end
directory "/etc/httpd" do
owner "root"
group "root"
mode 0755
action :create
not_if { File.exists?('/etc/httpd') }
#!/usr/bin/env ruby
#
# Author:: Joshua Timberman <joshua@opscode.com>
# Description:: Thor script that configures knife for a different platform.
#
# Copyright:: 2010, Opscode, Inc <legal@opscode.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# The end result when the recipe is run is:
node[:openldap][:ldap_conf][:servers] = [ "ldap://ldap1.internal.com", "ldap://ldap2.internal.com", "ldap://server.office.com" ]
# but what I *expected* was this:
node[:openldap][:ldap_conf][:servers] = [ "ldap://server.office.com" ]
require 'etc'
package "terminal/screen" do
action :install
end
screen_users = ['root']
search("users", "*:*").each { |u| screen_users << u.id }
screenrc_paths = []
if node['dmi']['system']['manufacturer'] == "Dell Inc."
source_file = "set_hostname-physical"
else
source_file = "set_hostname"
end
cookbook_file "/etc/init.d/set_hostname" do
source source_file
owner "root"
group "root"
@mdkent
mdkent / default.rb
Created January 6, 2012 18:18 — forked from miketheman/default.rb
Chef: Handling older Amazon AMI instances running sysklogd instead of rsyslog
# In the rsyslog/recipe/default.rb, wrap the "package: command:
# We have to hack around yum dependency resolution since Amazon's Linux AMI is already using sysklogd
# and yum doesn't handle the swap out well enough
if platform?("amazon") && node['platform_version'] == "2010.11.2" # <== This is the version we are running.
# This was changed in version 2011.02, so any instances launched after that should be fine.
# No idea about other version numbers
cookbook_file "/tmp/yum-shell-rsyslog.yum" do
source "yum-shell-rsyslog.yum"
owner "root"
@mdkent
mdkent / default.rb
Created January 6, 2012 18:50 — forked from miketheman/default.rb
Chef: Handling older Amazon AMI instances running sysklogd instead of rsyslog
# In the rsyslog/recipe/default.rb, wrap the "package: command:
# We have to hack around yum dependency resolution since Amazon's Linux AMI is already using sysklogd
# and yum doesn't handle the swap out well enough
if platform?("amazon") && node['platform_version'] == "2010.11.2" # <== This is the version we are running.
# This was changed in version 2011.02, so any instances launched after that should be fine.
# No idea about other version numbers
cookbook_file "/tmp/yum-shell-rsyslog.yum" do
source "yum-shell-rsyslog.yum"
owner "root"
@mdkent
mdkent / 0-readme.md
Created January 30, 2012 18:58 — forked from burke/0-readme.md
ruby-1.9.3-p0 cumulative performance patch.

Patched ruby 1.9.3-p0 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p0 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84).

Huge thanks to funny-falcon for the performance patches.