Skip to content

Instantly share code, notes, and snippets.

@stensonb
stensonb / gist:3205132
Created July 30, 2012 05:38
grails jetty elasticsearch woes...
2012-07-30 05:32:59.971:INFO:oejdp.ScanningAppProvider:Deployment monitor /app/scool/webapps at interval 1
2012-07-30 05:32:59.980:INFO:oejd.DeploymentManager:Deployable added: /app/scool/webapps/root.war
2012-07-30 05:33:00.057:INFO:oejw.WebInfConfiguration:Extract jar:file:/app/scool/webapps/root.war!/ to /tmp/jetty-0.0.0.0-8080-root.war-_-any-/webapp
2012-07-30 05:33:42.890:INFO:root:No Spring WebApplicationInitializer types detected on classpath
2012-07-30 05:33:44.444:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/,file:/tmp/jetty-0.0.0.0-8080-root.war-_-any-/webapp/},/app/scool/webapps/root.war
2012-07-30 05:33:44.445:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/,file:/tmp/jetty-0.0.0.0-8080-root.war-_-any-/webapp/},/app/scool/webapps/root.war
2012-07-30 05:33:44.445:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/,file:/tmp/jetty-0.0.0.0-8080-root.war-_-any-/webapp/},/app/scool/webapps/root.war
0 [main] WARN org.codehaus.groovy.grails.commons.cfg.ConfigurationHelper
@stensonb
stensonb / gist:5585093
Created May 15, 2013 16:02
Powershell LWRP "returns" attribute not working
powershell "exit-code-greater-than-one" do
returns 42
code <<-EOH
exit 42
EOH
end
@stensonb
stensonb / gist:5806361
Created June 18, 2013 15:30
failed ridley call from Windows
Ridley::Errors::ConnectionFailed: #<Ridley::Errors::ConnectionFailed:0x3353be0>
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/celluloid-0.14.1/lib/celluloid/responses.rb:29:in `value'
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/celluloid-0.14.1/lib/celluloid/calls.rb:95:in `value'
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/celluloid-0.14.1/lib/celluloid/proxies/sync_proxy.rb:28:in `method_missing'
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/celluloid-0.14.1/lib/celluloid/legacy.rb:14:in `method_missing'
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/celluloid-0.14.1/lib/celluloid/proxies/actor_proxy.rb:25:in `_send_'
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/celluloid-0.14.1/lib/celluloid/pool_manager.rb:41:in `_send_'
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/celluloid-0.14.1/lib/celluloid/pool_manager.rb:122:in `method_missing'
from C:/opscode/chef/embedded/lib/ruby/ge
@stensonb
stensonb / gist:6282264
Created August 20, 2013 14:40
LWRP for creating databag item...
# this provider stores details of the exchange to monitor into the databag
#
# the databag, then, is used to build the config file which the application
# users for monitoring
action :create do
id = @new_resource.id
exchangeName = @new_resource.exchangeName
routingKey = @new_resource.routingKey
@stensonb
stensonb / gist:6282281
Created August 20, 2013 14:41
stacktrace gist for rabbitears lwrp
Net::HTTPServerException: ppa_rabbit_ears_monitor_exchange[TradeSubmissionContract] (ppa_rabbit_ears::_testing_monitor_exchange line 1) had an error: Net::HTTPServerException: 405 "Method Not Allowed"
C:/opscode/chef/embedded/lib/ruby/1.9.1/net/http.rb:2632:in `error!'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/rest.rb:199:in `block in raw_http_request'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/rest.rb:280:in `retriable_rest_request'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/rest.rb:164:in `raw_http_request'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/rest.rb:158:in `api_request'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/rest.rb:125:in `put'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/data_bag.rb:123:in `save'
c:/chef/cache/cookbooks/ppa_rabbit_ears/providers/monitor_exchange.rb:20:in `block in class_from_file'
C:/opscode/chef/embedded/lib/rub
@stensonb
stensonb / gist:7375801
Created November 8, 2013 19:00
two chefspec runs...
rake spec
(in /Users/bryans/github/ppa.cookbooks/ppa)
/Users/bryans/.rvm/rubies/ruby-1.9.3-p392/bin/ruby -S rspec ./spec/libraries/service_registrar_spec.rb ./spec/providers/register_wcf_service_endpoint_spec.rb --colour --format progress
..../Users/bryans/github/ppa.cookbooks/windows/libraries/helper.rb:24: warning: already initialized constant AUTO_RUN_KEY
/Users/bryans/github/ppa.cookbooks/windows/libraries/helper.rb:25: warning: already initialized constant ENV_KEY
/Users/bryans/github/ppa.cookbooks/windows/libraries/version.rb:33: warning: already initialized constant VER_SUITE_BACKOFFICE
/Users/bryans/github/ppa.cookbooks/windows/libraries/version.rb:35: warning: already initialized constant VER_SUITE_BLADE
/Users/bryans/github/ppa.cookbooks/windows/libraries/version.rb:37: warning: already initialized constant VER_SUITE_COMPUTE_SERVER
/Users/bryans/github/ppa.cookbooks/windows/libraries/version.rb:39: warning: already initialized constant VER_SUITE_DATACENTER
/Users/bryans/github/ppa.cookbooks/windows/
require 'chefspec'
#require File.join(File.dirname(__FILE__), '*.rb')
PROJECT_ROOT = File.expand_path('../..', __FILE__)
$cookbook_paths = [
File.expand_path('../../..', __FILE__),
File.expand_path('../cookbooks', __FILE__)
]
require 'spec_helper'
describe 'some stuff' do
it 'does things' do
ChefSpec::Runner.new.converge('ppa::default')
end
it 'does other things' do
ChefSpec::Runner.new.converge('ppa::default')
end
@stensonb
stensonb / gist:de77d84a38cb63bd9bac
Created October 10, 2014 21:11
the greed game score() method
class Greed
def score(dice)
score = 0
histogram = {}
# model the array into a histogram
dice.each do |die|
histogram[die] += 1 unless histogram[die].nil? # +1 if the value existed
histogram[die] = 1 if histogram[die].nil? # add the value if it was nil
end
@stensonb
stensonb / gist:23fea108ecc045706d27
Created October 10, 2014 21:26
with input validation
class Greed
def score(dice)
score = 0
histogram = {}
# input sanity
raise RuntimeError, "Uh...huh? I don't get it..." unless dice.is_a? Array
raise RuntimeError, "No cheating! The rules say you can only roll up to 5 dice!" unless dice.size <= 5
# model the array into a histogram