Skip to content

Instantly share code, notes, and snippets.

@josephholsten
josephholsten / vapp.rb
Created August 11, 2011 00:07
Application cookbook for solo
#
# Cookbook Name:: application
# Recipe:: solo
#
app = node[:app].to_hash
(app["server_roles"] & node.run_list.roles).each do |app_role|
app["type"][app_role].each do |thing|
node.run_state[:current_app] = app
include_recipe "application::#{thing}"
¿ knife cookbook site install git -VV
DEBUG: Using configuration from /Users/josephholsten/Developer/chef/.chef/knife.rb
Installing git to cookbooks
DEBUG: sh(git branch --no-color)
chef-vendor-git
* master
DEBUG: sh(git status --porcelain)
?? typescript
Checking out the master branch.
DEBUG: sh(git checkout master)
@josephholsten
josephholsten / gist:4075283
Created November 14, 2012 22:23
logstash upstart
description "logstash"
author "me@example.com"
start on startup
stop on shutdown
script
cd /opt/logstash/server/
exec 2>&1
# Need to set LOGSTASH_HOME and HOME so sincedb will work
@josephholsten
josephholsten / Cheffile
Created November 16, 2012 04:45
Librarian failing
#!/usr/bin/env ruby
#^syntax detection
site 'http://community.opscode.com/api/v1'
#
# cookbooks only on github
cookbook 'ruby_build',
git: 'https://github.com/fnichol/chef-ruby_build',
ref: 'v0.6.0'
cookbook 'rbenv',
@josephholsten
josephholsten / fakify.rb
Last active December 10, 2015 13:28
because creating fake data is annoying
class Date
def self.random(from=Date.new(1970), to=Time.now.to_date)
rand(from..to)
end
end
module ActiveRecord
class Base
def self.fake_attributes(use_nulls=false)
Hash[self.columns.map {|c| c.random_record(use_nulls) }]
@josephholsten
josephholsten / gist:5016869
Created February 22, 2013 21:58
rake tasks
task :upload_all do
sh 'knife environment from file environments/*.rb'
sh 'knife role from file roles/*.rb'
sh 'knife data_bag from file -a'
sh 'knife cookbook upload -a'
end
desc "Runs foodcritic linter"
task :foodcritic do
if Gem::Version.new("1.9.2") <= Gem::Version.new(RUBY_VERSION.dup)
@josephholsten
josephholsten / nolo-json-format.md
Created March 12, 2013 21:36
Nolo to JSON impedence: who wins?

Nolo to JSON impedence: who wins?

A typical sort of plugin I'd like nolo to support would work like this:

% ./app_plugin
connections_open 216 time=1200928930 type=uint16 host=darkstar
requests 153 release=2.24.2.4271 type=uint8 host=darkstar

While I'm interesting in writing pure adapters for things like collectd

<products>
<product
product_id="227307351"
name="Sam Edelman Women's Ximon"
sku_number="227307351"
manufacturer_name="Sam Edelman"
part_number="00736701885362">
<category>
<primary>Apparel~~Footwear</primary>
<secondary></secondary>
2013-10-21 18:33:10,257 [188006096@qtp-1522234469-0] ERROR org.codehaus.groovy.grails.web.servlet.view.GroovyPageView - Error processing GroovyPageView: Error executing tag <g:expander>: Error creating bean with name 'UtilityTagLib': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [UtilityTagLib]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: UtilityTagLib$_closure1 at /WEB-INF/grails-app/views/error.gsp:39
org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Error executing tag <g:expander>: Error creating bean with name 'UtilityTagLib': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [UtilityTagLib]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: UtilityTagLib$_closure1 at /WEB-INF/grails-app/views/error.gsp:39
at gsp_rundeckerror_gsp$_run_closure
# cat rundeck-config.properties
loglevel.default=INFO
rdeck.base=/var/lib/rundeck
rss.enabled=true
dataSource.dbCreate = update
dataSource.url = jdbc:mysql://rundeck-db.example/rundeck?autoReconnect=true
dataSource.username = rundeck
dataSource.password = sekret