Skip to content

Instantly share code, notes, and snippets.

# Our .tmux.conf file
# Setting the prefix from C-b to C-a
# START:prefix
set -g prefix C-a
# END:prefix
# Free the original Ctrl-b prefix keybinding
# START:unbind
unbind C-b
# END:unbind
@tfitch
tfitch / 1_desired_template_output.conf
Last active September 8, 2015 16:07
CE code test
[appdefaults]
{
example.com {
kdc = x1.example.com:88,
kdc = x2.example.com:88,
kdc = x3.example.com:88,
kdc = x4.example.com:88,
kdc = x5.example.com:88,
kdc = x6.example.com:88,
kdc = exampledcoce.example.com:88,
@tfitch
tfitch / default.rb
Created March 18, 2015 20:20
Chef data bags with environments
# the key here is line 4 where the node.chef_environment will match an element of the JSON
keyfile_bag = Chef::EncryptedDataBagItem.load("mongodb", "keyfiles")
file '/apps/mongodb-linux-x86_64-2.4.8/conf/mongodb.key' do
content keyfile_bag[node.chef_environment]['keyfile']
owner 'mongo'
group 'mongo'
mode 00700
action :create_if_missing
end
@tfitch
tfitch / keybase.md
Created September 23, 2014 00:28
keybase.md

Keybase proof

I hereby claim:

  • I am tfitch on github.
  • I am tfitch (https://keybase.io/tfitch) on keybase.
  • I have a public key whose fingerprint is 4272 7EC0 E696 8F14 379E 3EE6 A825 0CFB 25FF 8901

To claim this, I am signing this object:

@tfitch
tfitch / replicaset.js.erb
Last active August 29, 2015 14:06
MongoDB Replica Set configuration file
rsconf = {
"_id" : "<% replicaset %>",
"version" : 1,
"members" : [
<% idCounter = 1 %>
<%- @secondaries.each do |secondary| %>
{
"_id" : <%= idCounter %>,
"host" : "<%= secondary.fqdn %>:27017"
},
@tfitch
tfitch / primary.rb
Last active August 29, 2015 14:06
recipe for MongoDB Replica Set Primary node
# some stuff was probably above here
# chef_environment might look redundant, but it will find machine in the same environment this machine is configured for
secondaries = search(:node, "role:mongodb-secondary AND chef_environment:#{node.chef_environment} AND mongodb_replica_set:#{node.mongodb.replica_set}")
# pass them in to the template below
template '/apps/mongodb/conf/replicaset.js' do
owner 'mongodb'
group 'users'
mode '0755'
@tfitch
tfitch / knife_search.sh
Created September 6, 2014 04:33
Knife node search
knife search node "role:mongo AND chef_environment:dev AND mongodb_replica_set:ReplSet1"
@tfitch
tfitch / dynamic-recipe-works.rb
Created September 1, 2014 21:22
Name/value pairs dynamic works
# same result as hardcoded-recipe.rb but now driven by Attributes
iis_pool 'MyAppPool' do
node['config']['setting'].each do |setting, value|
send(setting, value)
end
action :config
end
@tfitch
tfitch / dynamic-recipe-fail.rb
Last active August 29, 2015 14:05
Name/value pairs dynamic fail
# outputs the same as hardcoded-recipe.rb but does *not* work
iis_pool 'MyAppPool' do
node['config']['setting'].each do |setting, value|
"#{setting}" "#{value}"
end
action :config
end
@tfitch
tfitch / attributes.rb
Created September 1, 2014 20:55
Name/Value pairs as attributes
# attributes for the iis_pool
default['config']['setting']['runtime_version'] = '12'
default['config']['setting']['thirty_two_bit'] = false
default['config']['setting']['max_proc'] = 4