Skip to content

Instantly share code, notes, and snippets.

View nweddle's full-sized avatar
:octocat:

Nathan Weddle nweddle

:octocat:
View GitHub Profile

Creating a Custom Cookbook Generator

There are a few resources on the internet today about creating custom cookbook generators. The most popular is chef-gen-flavors.

These resources are generally pretty meta and slightly hard to understand, so I'm going to walk you through customizing a cookbook generator from the ground up. To do this we're going to start with a great generator called pan. After we customize the generators we're going to build the gem and install it locally.

One thing to know about chef-gen-flavors is that its heavily name based, so where-ever you see Pan and I'm replacing it with awesomesauce, you can replace with whatever the name of your flavor is, but it must be replaced in all of the same places.

Clone the repo

@scarolan
scarolan / gist:f93a8f9b362c4d3a4436
Last active November 20, 2015 19:27
Set the tab name in iTerm to contain the current directory and git branch
function set_iterm_title {
echo -ne "\e]1;$1\a"
}
function git_branch {
BRANCH_REFS=$(git symbolic-ref HEAD 2>/dev/null) || return
GIT_BRANCH="${BRANCH_REFS#refs/heads/}"
[ -n "$GIT_BRANCH" ] && echo "$GIT_BRANCH "
}
@dougireton
dougireton / knife.rb
Last active November 4, 2018 02:41
Flexible knife.rb to support switching between multiple Chef orgs - ~/.chef/knife.rb
# Copyright 2015 Nordstrom, 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
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@rf-
rf- / nvim-client
Last active December 9, 2024 06:07
#!/usr/bin/env python
import pynvim, os, re, sys, time
# Get a list of buffers that haven't been deleted. `nvim.buffers` includes
# buffers that have had `:bdelete` called on them and aren't in the buffer
# list, so we have to filter those out.
def get_listed_buffers(nvim):
return set(buf.number for buf in nvim.buffers \
if nvim.eval('buflisted(%d)' % buf.number))
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@maxnasonov
maxnasonov / Proxy.ps1
Last active December 13, 2016 22:15 — forked from p0w3rsh3ll/Proxy.ps1
# Define a proxy
Configuration Proxy {
$whitelist = '*.google.com;*.example.com;192.168.*;127.*;localhost'
$prefix_hex = [String]::Format("{0:X}", [Convert]::ToUint32($prefix.tochararray()[0]))
$suffix_hex = [String]::Format("{0:X}", [Convert]::ToUint32($suffix.tochararray()[0]))
$proxy_url = "proxy.example.com:3128"
$proxy_url_length = '{0:X}' -f $proxy_url.length
$proxy_url_hex = StringToHex -string $proxy_url
$whitelist_hex = StringToHex -string $whitelist
$whitelist_length = '{0:X}' -f $whitelist.length
#--------------------
#
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
#
@jeremiahsnapp
jeremiahsnapp / 01_setup_dev-lxc.md
Last active July 19, 2016 07:52
Quick Setup dev-lxc-platform
@mefellows
mefellows / BundleConfig.ps1
Last active December 25, 2023 23:33
Sysprepped Windows AMI using Packer
$EC2SettingsFile="C:\\Program Files\\Amazon\\Ec2ConfigService\\Settings\\BundleConfig.xml"
$xml = [xml](get-content $EC2SettingsFile)
$xmlElement = $xml.get_DocumentElement()
foreach ($element in $xmlElement.Property)
{
if ($element.Name -eq "AutoSysprep")
{
$element.Value="Yes"
}
@carlessanagustin
carlessanagustin / update-playbook.sh
Last active June 9, 2021 16:59
Quick Bash script for running Ansible Playbooks
#!/usr/bin/env bash
########################## REQUIREMENTS
# sudo apt-get install ansible unzip
########################## VARIBLES
PLAYBOOK_GZ="playbook.zip"
PLAYBOOK_FILE="update.yml"
INVENTORY_FILE="all"
EXTRA_ARGS="--list-tasks --list-hosts"