Skip to content

Instantly share code, notes, and snippets.

View jtimberman's full-sized avatar
🚀

Joshua Timberman jtimberman

🚀
View GitHub Profile
(require 'chef)
(resource :file "/tmp/foo"
:owner "cb"
:action :create)
(resource :file (concatenate 'string
"/tmp/"
(node-attributes :hostname)
"-made-with-lisp")
@jtimberman
jtimberman / ec2_client.rb
Created March 2, 2010 03:38
generate user_data.json with knife, launch instance with it and magic!
# Author:: Adam Jacob <adam@opscode.com>
# Author:: Joshua Timberman <joshua@opscode.com>
#
# Copyright 2009-2010, Opscode, Inc
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
@fujin
fujin / ebs_raid6_provider.rb
Created May 8, 2011 03:20
aws_ebs_raid6 lwrp
include Chef::Mixin::Command
action :create do
size = new_resource.size
volumes = new_resource.volumes.times.map{|i| (i == 0 ? "/dev/sdf" : "/dev/sdf#{i}") }
setra = new_resource.blockdev_setra
volume_group = new_resource.volume_group
logical_volume = new_resource.name
mdadm_device = new_resource.mdadm_device
mount_point = new_resource.mount_point
@jtimberman
jtimberman / network_addr.rb
Created June 22, 2011 16:53
Ohai plugin to provide semantically nice attributes for network interfaces
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Copyright:: Copyright (c) 2011 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
@jtimberman
jtimberman / gist:1040853
Created June 22, 2011 19:07
Ohai plugin to return semantic reference attributes for network addresses
# This might not work on newer (than 0.10.6) versions of Chef.
# Thanks for pointing to my new gist, spkane :)
# https://gist.github.com/1040543
require 'rubygems'
require 'ohai'
o = Ohai::System.new()
o.all_plugins
@fnichol
fnichol / macosx_bootstrap.sh
Last active January 31, 2022 21:09
Mac OS X 10.7/10.8/10.9 (Lion/Mountain Lion/Mavericks) Bootstrapping
#!/usr/bin/env bash
set -e
# # Mac OS X 10.7/10.8/10.9/10.10 Bootstrapping
#
# ## Pre-requisites
#
# 1. Set your hostname: In **System Preferences** go to **Sharing** and enter
# the name in **Computer Name**
# 2. Run **Software Update** and reboot if necessary
@dysinger
dysinger / cookbooks.sh
Created November 30, 2011 18:55
Re-write Opscode Cookbooks as individual Git repos
#!/bin/bash
for cookbook in $(find * -type d -maxdepth 0); do
git clone ./ ../${cookbook}
cd ../${cookbook}
git remote rm origin
git filter-branch --subdirectory-filter ${cookbook} -- --all
git gc --aggressive
done
@jonlives
jonlives / gist:1486734
Created December 16, 2011 16:30
Bootstrap Manifest for Chef on OS X
bash -c '
cd ~/Desktop
curl -O http://joncowie.local/xcode.tar.gz
tar -zxf xcode.tar.gz
installer -pkg ~/Desktop/Install\ Xcode.app/Contents/Resources/Xcode.mpkg -target "/"
@mislav
mislav / stupid-json.rb
Created December 21, 2011 12:31
Stupid simple JSON parser & generator
# encoding: utf-8
#
## Stupid small pure Ruby JSON parser & generator.
#
# Copyright © 2013 Mislav Marohnić
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the “Software”), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify,
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
@fnichol
fnichol / README.md
Created December 28, 2011 17:41
Vagrantify: Create a chef-solo enabled Vagrant virtual machine for development

Installation

gem install thor
mkdir -p ~/vagrants && cd ~/vagrants
curl -LO https://raw.github.com/gist/1528832/vagrantify
chmod 755 vagrantify

Usage

./vagrantify init webserver