Skip to content

Instantly share code, notes, and snippets.

View bknowles's full-sized avatar

Brad Knowles bknowles

View GitHub Profile
@bknowles
bknowles / README.md
Created October 25, 2011 23:09 — forked from atomic-penguin/README.md
multi-knife-howto

Overview

Here is an example shared configuration for knife. You can drop this off in your chef-repo/.chef/ directory, and multiple developers can use the same knife configuration to interact with more than one Chef server, or the Opscode platform.

By using Bash functions and environment variables we can change the chef server, which knife is configured to use, on the fly.

NOTE: knife will probably ignore your ~/.chef/knife.rb once you begin using a shared knife.rb in your chef-repo directory.

Preparation

## Knife plugin to set node environment
# See http://wiki.opscode.com/display/chef/Environments
#
## Install
# Place in .chef/plugins/knife/set_environment.rb
#
## Usage
# Nick-Stielaus-MacBook-Pro:chef-repo nstielau$ knife node set_environment mynode.net my_env
# Looking for mynode.net
# Setting environment to my_env
@bknowles
bknowles / pre-commit.rb
Created January 3, 2014 23:15
Git hook to require code passes "knife cookbook test" and foodcritic tests, before uploading.
#!/usr/bin/env ruby
REPO_PATH = `git rev-parse --show-toplevel`.chomp
COMPONENTS_PATH = "#{REPO_PATH}/cookbooks/components"
PROFILES_PATH="#{REPO_PATH}/cookbooks/profiles"
puts "Running knife cookbook test against all cookbooks in #{COMPONENTS_PATH} and #{PROFILES_PATH}"
knife_output = `$(which knife) cookbook test -a -o #{ COMPONENTS_PATH } #{ PROFILES_PATH }`
unless $?.success?
puts knife_output
@bknowles
bknowles / xkcd_passphrase.rb
Last active August 29, 2015 13:58 — forked from ThaiWood/xkcd_passphrase.rb
Here's my first pass at getting the code to pass all rubocop citations.
#!/usr/bin/ruby
require 'net/http'
require 'nokogiri'
require 'rss'
require 'open-uri'
google_news_query = 'http://news.google.com/news/feeds?q=apologize&output=rss'
google_news_result_url = ''
wordlist = []
@bknowles
bknowles / https-testssl.sh
Created February 18, 2017 02:13
Sample output from testssl.sh for issue #638
$ ./testssl.sh https://testssl.sh
###########################################################
testssl.sh 2.9dev from https://testssl.sh/dev/
(d2cbbaf 2017-02-16 19:10:59 -- )
This program is free software. Distribution and
modification under GPLv2 permitted.
USAGE w/o ANY WARRANTY. USE IT AT YOUR OWN RISK!
@bknowles
bknowles / logjam-sample.txt
Created February 21, 2017 19:59
Sample run showing problems outlined in "testssl.sh fails at LOGJAM test", Issue #643
$ ./testssl.sh https://testssl.sh
###########################################################
testssl.sh 2.9dev from https://testssl.sh/dev/
(be079ac 2017-02-21 11:16:14 -- )
This program is free software. Distribution and
modification under GPLv2 permitted.
USAGE w/o ANY WARRANTY. USE IT AT YOUR OWN RISK!
@bknowles
bknowles / logjam-sample-vx.txt
Created February 21, 2017 20:04
Sample run showing problems outlined in "testssl.sh fails at LOGJAM test", Issue #643 (verbose mode)
This file has been truncated, but you can view the full file.
$ ./testssl.sh https://testssl.sh
#!/usr/bin/env bash -vx
#
# vim:ts=5:sw=5:expandtab
# we have a spaces softtab, that ensures readability with other editors too
[ -z "$BASH_VERSINFO" ] && printf "\n\033[1;35m Please make sure you're using \"bash\"! Bye...\033[m\n\n" >&2 && exit 245
+ '[' -z 3 ']'
[ $(kill -l | grep -c SIG) -eq 0 ] && printf "\n\033[1;35m Please make sure you're calling me without leading \"sh\"! Bye...\033[m\n\n" >&2 && exit 245
kill -l | grep -c SIG