Skip to content

Instantly share code, notes, and snippets.

View jtimberman's full-sized avatar
🚀

Joshua Timberman jtimberman

🚀
View GitHub Profile
@jtimberman
jtimberman / gist:9837538
Created March 28, 2014 16:55 — forked from jsierles/gist:84082
The original "knife" - a Thor task file for interacting with a Chef Server API, ca. the Stone Age of Chef :).
#!/usr/bin/ruby
#
# Joshua Sierles, 37signals, 2009
require 'rubygems'
require 'thor'
require 'chef'
require 'chef/node'
require 'chef/rest'
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@jtimberman
jtimberman / schedule_host_downtime.sh
Created May 1, 2014 22:52
Usage: sudo ./schedule_host_downtime.sh HOSTNAME
#!/bin/bash
# this is the location on ubuntu systems. ymmv.
cmd_file="/var/lib/nagios3/rw/nagios.cmd"
now=`date +%s`
duration=7200
end=`expr $now + $duration`
fixed=1
hostname=$1
echo -ne "[${now}] SCHEDULE_HOST_DOWNTIME;${hostname};${now};${end};${fixed};0;7200;${SUDO_USER:-$USER};Scheduled Downtime CLI\n" $now > $cmd_file
action :create do
converge_by("create #{new_resource.id} in #{new_resource.data_bag} with Chef::Vault") do
item = ChefVault::Item.new(new_resource.data_bag, new_resource.id)
item.raw_data = new_resource.raw_data.merge('id' => new_resource.id)
item.search(new_resource.search)
item.clients(new_resource.clients)
item.admins(join_comma)
item.save
end
end
do shell script "xcode-select --install"
do shell script "sleep 1"
tell application "System Events"
tell process "Install Command Line Developer Tools"
keystroke return
click button "Agree" of window "License Agreement"
end tell
end tell
[user]
name = Joshua Timberman
email = joshua@housepub.org
[color]
ui = true
diff = true
status = true
branch = true
interactive = true
[core]
@jtimberman
jtimberman / gist:875f8ce947a4a3e8c2e2
Created November 13, 2014 20:02
chefdk 0.3.4 version manifest
% cat /opt/chefdk/version-manifest.txt
chefdk 0.3.4
Component Installed Version Version GUID Overridden From
-----------------------------------------------------------------------------------------------------------------
appbundler 0.2.0 0.3.0
berkshelf v3.2.0 git:054fa5f8b63c66ccd9eead2f0e98d8bc9da448c3 master
bundler 1.7.5 1.5.3
cacerts 2014.08.20 md5:c9f4f7f4d6a5ef6633e893577a09865e 2014.09.03
chef 11.16.4 git:97677f911e85b2b0db4247723930f30fb4a02c66 master
@jtimberman
jtimberman / nginx.conf
Created November 30, 2014 17:03
Gist for archival purposes, via the wayback machine https://web.archive.org/web/20131222092914/http://brainspl.at/nginx.conf.txt - brainspl.at seems to be offline :(
# Gist for archival purposes, via the wayback machine,
# https://web.archive.org/web/20131222092914/http://brainspl.at/nginx.conf.txt
# - brainspl.at seems to be offline :(
#
# View other versions at https://web.archive.org/web/*/http://brainspl.at/nginx.conf.txt
#
# user and group to run as
user ez ez;
# number of nginx workers
# Chef 11.18.0.rc.1
% /opt/chefdk/bin/chef-client -o home -z -l error
Starting Chef Client, version 11.18.0.rc.1
resolving cookbooks for run list: ["home"]
Synchronizing Cookbooks:
- home
Compiling Cookbooks...
[2014-12-03T08:52:10-07:00] ERROR: Your HOME is: /Users/jtimberman
# Chef 12.0.0.rc.0
save-last-command() {
last_command=$(fc -nl 0)
command_name="$1"
read -r -d '' new_fun <<EOF
${command_name}() {
$last_command
}
EOF
eval "$new_fun"
}