Skip to content

Instantly share code, notes, and snippets.

View colinrymer's full-sized avatar

Colin Rymer colinrymer

View GitHub Profile
@colinrymer
colinrymer / MIT License
Created November 21, 2012 18:05 — forked from jcf/MIT License
RSpec matcher for parsing `response.headers['Content-Type']`
Copyright (c) 2012 James Conroy-Finn, Colin Rymer
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTW
@colinrymer
colinrymer / idg-bootstrap.rb
Created January 17, 2013 00:46
bootstrap script for Primedia IDG setup
require 'fileutils'
include FileUtils
puts "\n\n------------------------------------------"
puts" Welcome to the IDG installation process."
puts "------------------------------------------\n\n"
print "Please enter your GitHub username:"
github_username = gets.chomp!
install_dir = "/tmp/idg_installation"
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@colinrymer
colinrymer / brews
Last active December 14, 2015 18:39
Get a list of installed homebrew formula with any options used to install them.
#!/usr/bin/env ruby
#
# Colin Rymer - 2013-03-10
require 'json'
Dir.glob('/usr/local/Cellar/**/INSTALL_RECEIPT.json').each do |brew|
name = brew.split('/')[4]
receipt = JSON.load(File.open(brew))
options = receipt['used_options'].join(' ')
puts "#{name} #{options unless options.empty?}"

Given

  • Nodes can be either master or slaves.
  • Nodes register themselves with their master on creation.

Scenario 1 - No existing nodes

Some number (n) of new nodes are created. Nodes have no knowledge of other nodes being created and elect themselves as master. This results in n master nodes and 0 slave nodes.

Noah Agent Options

Options for making changes are:

  • chef-client run
  • chef single recipe run
  • custom shell script

A Noah watcher/agent LWRP will be provided that allows chef recipes to register

description "Noah Agent"
# automatically start
start on filesystem
# working directory
chdir <%= @noah_agent_dir %>
# command to run, with Bundler support!
exec bundle exec ruby <%= @noah_agent %> -p <%= @noah_agent_port %> -e production 2>&1 <%= @noah_agent_log %>

###Given

  DEFAULTS = {
    foo: lambda { ENV['FOO'] },
    bar: lambda { ENV['BAR'] },
    bazz: 0.1
  }

##Which is preferred:

  • Use Jamfile to list jam dependencies.
  • Create a temp package.json with correct baseURL, etc.
  • Install external dependencies to app/assets/javascripts/lib/
  • Convert tag helper to add files in asset lib dir to requirejs config
  • Fix compilation to include digests
  • Update helper to check for digests.yml file
#!/usr/bin/env ruby
# A pre-commit hook script to ensure that no local gem dependencies (gem 'asdf', path: '~/local')
# exist in your Gemfile before commiting.`
# Allows gems to be loaded from source within the current project, but not from outside.
puts 'Checking for local dependencies in your Gemfile.'
ROOT_PATH = File.expand_path('../../..', __FILE__)
begin
require 'rubygems'
gemfile = ENV['BUNDLE_GEMFILE'] || File.join(ROOT_PATH, 'Gemfile')
require 'bundler/setup' if File.exists?(gemfile)