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 / alternate-attributes-recipe.rb
Created December 8, 2013 08:30
Managing Jenkins plugins with Chef
default.jenkins.plugins = {
# a snippet of what would be a long list
'instant-messaging' => '1.28',
'jabber' => '1.25',
'jobConfigHistory' => '1.39'
}
@tfitch
tfitch / gist:5889768
Created June 29, 2013 04:35
Sun Java 1.5 Chef install command
bash "install-jdk15" do
cwd "/install/location/path"
code <<-EOH
./jdk-1_5_0_XYZ-linux-i586.bin >/dev/null < <(echo yes) >/dev/null < <(echo yes)
rm -rf /install/location/path/jdk1.5.0_XYZ/sample
rm -rf /install/location/path/jdk1.5.0_XYZ/demo
ln -s /install/location/path/jdk1.5.0_XYZ /install/location/path/java
EOH
not_if { ::File.exists?('/install/location/path/jdk1.5.0_XYZ/README.html') }
end
@tfitch
tfitch / gist:5889761
Created June 29, 2013 04:33
Download the Java installer from your Artifactory server
remote_file "/install/location/path/jdk-1_5_0_XYZ-linux-i586.bin" do
source "http://your.artifactory.example.com/artifactory/yourRepo/jdk-1_5_0_XYZ-linux-i586.bin"
mode "0700"
not_if { ::File.exists?('/install/location/path/jdk-1_5_0_XYZ-linux-i586.bin') }
end
@tfitch
tfitch / gist:5889735
Created June 29, 2013 04:23
Use Magic_Shell to create $JAVA_HOME var
magic_shell_environment 'JAVA_HOME' do
value '/install/location/path/java'
end
@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'