Skip to content

Instantly share code, notes, and snippets.

View jtimberman's full-sized avatar
🚀

Joshua Timberman jtimberman

🚀
View GitHub Profile
@danielsdeleo
danielsdeleo / gist:3063064
Created July 6, 2012 22:17
Knife Role Tree example output
ddeleo@boltzmann chef git:(master)> bin/knife role tree $node_name
top level
|-role[preprod]
| |-recipe[network]
| |-recipe[splunk42]
|-role[mysql-master]
| |-role[base]
| | |-role[platform-annoyances]
| | | |-recipe[platform-specific]
| | | |-recipe[selinux::disabled]
@atomic-penguin
atomic-penguin / symbol_to_string.sh
Created June 21, 2012 20:35
Foodcritic FC001 fixer script.
#!/bin/bash
if [ "$#" -eq 0 ]; then
echo "Usage: `basename $0` <cookbook directory>"
elif [ "$#" -eq 1 ]; then
find $1 -name "*[.md|.rb]" ! -name "*.git" ! -name "*.erb" | xargs perl -p -e 's!\[:([a-z0-9_]+)\]![\x27$1\x27]!gi' -i
echo "Commit message:"
echo "FC001: Use strings in preference to symbols to access node attributes"
fi
@ctdk
ctdk / github.js.diff
Created June 13, 2012 17:39
Diff to fix Octopress' github.js to make it not use the deactivated Github v2 API
diff --git a/source/javascripts/github.js b/source/javascripts/github.js
index 678775a..bc4c9bd 100644
--- a/source/javascripts/github.js
+++ b/source/javascripts/github.js
@@ -3,22 +3,22 @@ var github = (function(){
var i = 0, fragment = '', t = $(target)[0];
for(i = 0; i < repos.length; i++) {
- fragment += '<li><a href="'+repos[i].url+'">'+repos[i].name+'</a><p>'+repos[i].description+'</p></li>';
+ fragment += '<li><a href="'+repos[i].html_url+'">'+repos[i].name+'</a><p>'+repos[i].description+'</p></li>';
@danielsdeleo
danielsdeleo / gist:2920702
Created June 12, 2012 23:06
Eval and Converge a Single Chef Recipe
#!/usr/bin/env ruby
recipe_path = ARGV[0]
if recipe_path.nil?
STDERR.puts "usage: chef-apply RECIPE_FILE"
exit 1
end
recipe_path = File.expand_path(recipe_path)
@coderanger
coderanger / __init__.py
Created June 11, 2012 00:57
Edited version of opscode's fabfile/
import os
from fabric.api import env, task, roles, run
from fabric.utils import abort
from chef import ChefAPI, autoconfigure
from chef.fabric import chef_roledefs
if 'OC_USER' in os.environ:
env.user = os.environ['OC_USER']
@danielsdeleo
danielsdeleo / resource_display.rb
Created May 22, 2012 19:45
Print a list of resources with the attributes filled in from node attrs, search, etc.
# (sudo) knife exec -c /etc/chef/client.rb resource_display.rb [FILTER]
# This will update the recipes and such on your machine, but it shouldn't make any real changes.
# Coded in 10 minutes, use at your own risk.
require 'chef/client'
require 'chef/checksum_cache'
require 'chef/provider'
require 'chef/providers'
require 'chef/resource'
require 'chef/resources'
@lusis
lusis / chef-listener.rb
Created May 19, 2012 07:35
The stupid hacky chef-listener I used in my talk at #chefconf
require 'webmachine'
require 'celluloid'
require 'json'
class ChefRunner
include Celluloid
def initialize(name)
@to_run = 0
@running = false
@paulmillr
paulmillr / active.md
Last active May 15, 2025 11:20
Most active GitHub users (by contributions). https://paulmillr.com

Most active GitHub users (git.io/top)

The list would not be updated for now. Don't write comments.

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Because of GitHub search limitations, only 1000 first users according to amount of followers are included. If you are not in the list you don't have enough followers. See raw data and source code. Algorithm in pseudocode:

githubUsers
@jtimberman
jtimberman / cookbook_check.rb
Created May 3, 2012 18:06
Check the cookbooks are frozen and specified in non development environments
if node.chef_environment != 'development'
cookbooks = {}
node.cookbook_collection.values.each {|c| cookbooks[c.name.to_s] = c.version.to_s }
# See https://github.com/danryan/spice
r = gem_package "spice" do
version "0.8.0"
end
r.run_action(:install)
#
# Author:: Joshua Timberman <[email protected]>
# Copyright:: Copyright (c) 2012, Joshua Timberman
# License:: Apache License, Version 2.0
#
# Ohai Plugin: external_ipaddress
#
# Save this to /etc/chef/ohai_plugins/external_ipaddress.rb, then run ohai with:
#
# ohai -d /etc/chef/ohai_plugins external_ipaddress