Skip to content

Instantly share code, notes, and snippets.

View fnichol's full-sized avatar

Fletcher Nichol fnichol

View GitHub Profile
##
# on each backend/non-routable cluster node
#
user_account "adminuser" do
ssh_keygen true
# other attributes perhaps?
end
# put the code in a ruby block so that it gets run in execution phase,
@fnichol
fnichol / chef-client-zero.rb
Last active December 17, 2015 21:09
Chef Client Zero!
#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
#
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
#
# Copyright (C) 2013, Fletcher Nichol
#
# 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
@fnichol
fnichol / README.md
Last active December 17, 2015 17:19
Reimplementing Cookbook Resolvers in Test Kitchen 1.0

Berksfile

site :opscode

metadata

cookbook 'apt'
cookbook 'yum'
cookbook 'apache2'
@fnichol
fnichol / log.txt
Created April 26, 2013 19:54
Razor node metadata on Chef Server
$ knife node show web1.razornet.local --medium
Here is my node’s output (note the “razor_metadata” and “razor_attributes” hashes):
root@chef:~# knife node show web1.razornet.local --medium
Node Name: web1.razornet.local
Environment: _default
FQDN: web1.razornet.local
IP: 172.16.33.130
Run List: role[web_server]
Roles: web_server
@fnichol
fnichol / script.sh
Created January 29, 2013 04:44
Subverting An Open Source Project; A Play In Three Acts
git clone git@github.com:fnichol/test-kitchen.git
cd test-kitchen
git remote add jamie git@github.com:jamie-ci/jamie.git
git fetch jamie && git fetch jamie --tags
git checkout --orphan 1.0
git rm -rf .
git merge jamie/master
git push origin 1.0 --tags
@fnichol
fnichol / non-changelog-releaselog.txt
Created January 24, 2013 05:16
Jamie gem's non-Changelog "Releaselog"
* c2684c1 - (v0.1.0.beta3) Release 0.1.0.beta2, required_config & main logfile. (10 days ago) (Fletcher Nichol)
* e66ae9f - (v0.1.0.beta2) Release 0.1.0.beta2, fixes, polish, & list statuses. (11 days ago) (Fletcher Nichol)
* 9b8f709 - (v0.1.0.beta1) Release 0.1.0.beta1, concurrent and kicking. (11 days ago) (Fletcher Nichol)
* 6c442bb - (v0.1.0.alpha21) Release 0.1.0.alpha21, the symbolized edition (she's breaking, yo). (2 weeks ago) (Fletcher Nichol)
* 62d1546 - (v0.1.0.alpha20) Release 0.1.0.alpha20, 'jamie login' subcommand & updated CLI args. (3 weeks ago) (Fletcher Nichol)
* 1f1d734 - (v0.1.0.alpha19) Release 0.1.0.alpha19, ALL YOUR LOGGING ARE BELONG TO US. (3 weeks ago) (Fletcher Nichol)
* cb32c82 - (v0.1.0.alpha18) Release 0.1.0.alpha18, improved rake/thor tasks, ruby >= 1.9.1 gem. (4 weeks ago) (Fletcher Nichol)
* ffc4bde - (v0.1.0.alpha17) Release 0.1.0.alpha17, smart actions, test cleanup, & dummy driver! (4 weeks ago) (Fletcher Nichol)
* f3896b6 - (v0.1.0.alpha16) Release 0.1.0.alpha16, breaking
@fnichol
fnichol / .bash_profile
Created January 18, 2013 03:16
tmux 'tn'
# Creates a session with the name of your current directory or attaches if the session exists
alias tn='tmux new -s "$(basename `pwd`)" || tmux at -t "$(basename `pwd`)"'
@fnichol
fnichol / bootstrap
Created January 7, 2013 17:57
Basic Project script/bootstrap
#!/usr/bin/env bash
set -e
[ -n "$BOOTSTRAP_DEBUG" ] && set -x
banner() { printf -- "-----> $*\n"; }
log() { printf -- " $*\n"; }
warn() { printf -- ">>>>>> $*\n"; }
fail() { printf -- "\nERROR: $*\n" ; exit 1 ; }
if ! command -v direnv >/dev/null ; then
@fnichol
fnichol / you_type.rb
Last active December 10, 2015 17:48
Fun little game for my daughter
#!/usr/bin/env ruby
#
# ruby <(curl -s https://gist.githubusercontent.com/fnichol/4469798/raw/you_type.rb)
def voices
@voices ||= %x[say -v ?].split("\n").map { |l|
l.gsub(/^(.+)en_.*$/, '\1').strip
}
end