Skip to content

Instantly share code, notes, and snippets.

View randomcamel's full-sized avatar

Chris Doherty randomcamel

View GitHub Profile
@randomcamel
randomcamel / rvm_dir_change
Created May 24, 2011 21:55
RVM changing directories, unhappily
+ builtin cd customization_server
+ local result=0
+ __rvm_project_rvmrc
+ local working_dir
+ [[ -n /Users/randomcamel/.rvm/scripts ]]
+ source /Users/randomcamel/.rvm/scripts/initialize
++ [[ -n 3.2.48(1)-release ]]
++ shopt -s extglob
++ export rvm_path=/Users/randomcamel/.rvm
++ rvm_path=/Users/randomcamel/.rvm
shopt -u cdable_vars
shopt -s cdspell
shopt -u checkhash
shopt -s checkwinsize
shopt -s cmdhist
shopt -u compat31
shopt -u dotglob
shopt -u execfail
shopt -s expand_aliases
shopt -u extdebug
@randomcamel
randomcamel / sinatra-multiple-values-fail
Created September 6, 2011 20:21
Sinatra failing to produce multiple param values
Sinatra 1.2.6 doesn't appear to properly handle multiple values for a form parameter. 'params[:my_param_name]'
only returns the last one supplied. I've verified that Chrome is sending the full list, and the list appears in
the rack.request.query_string variable (but not the rack.request.params variable).
get '/lame' do
erb :lame
end
post '/lame' do
puts params.inspect
@randomcamel
randomcamel / bunny_test.rb
Created January 4, 2012 04:47
Script to load a queue and then cause the error 'Error subscribing to queue qtest.broadcast (Bunny::ProtocolError)'
#!/usr/bin/env ruby
require 'rubygems'
require 'bunny'
# Chris Doherty, confused by Bunny::Queue#subscribe semantics.
# run with `ruby bunny_test.rb load` followed by `ruby bunny_test.rb consume`.
class BunnyTest
@randomcamel
randomcamel / separate_worker.rb
Last active December 11, 2015 14:48
Trying to separate out the process that submits jobs from the process that executes them. Under 1.8.7, the Worker doesn't pick up the job submitted by the 'run' case: the join() command just waits.
require 'rubygems'
require 'ruote' # 2.3.0.2
require 'ruote/storage/fs_storage'
def get_storage
Ruote::FsStorage.new("ruote_issue_work")
end
class MyParticipant < Ruote::Participant
@randomcamel
randomcamel / gist:5522598
Created May 5, 2013 23:42
Chef context of carbon-cache failing to start in the graphite-chef recipe.
[2013-05-05T23:37:03+00:00] INFO: Processing service[carbon-cache] action enable (graphite::carbon line 68)
[2013-05-05T23:37:03+00:00] INFO: Processing service[carbon-cache] action start (graphite::carbon line 68)
================================================================================
Error executing action `start` on resource 'service[carbon-cache]'
================================================================================
@randomcamel
randomcamel / hanging-celluloid-inspect.rb
Created July 26, 2013 00:51
If I try to call #inspect on an actor with an active Notifications subscription, it hangs. If you comment out either the `#inspect` call or the subscription, the program runs and exits quickly.
# Chris Doherty, code@randomcamel.net
require "celluloid"
require "celluloid/autostart"
class Cell
include Celluloid
include Celluloid::Notifications
attr_reader :count
@randomcamel
randomcamel / gist:9cbaf52e03fab6a3ee66
Created November 7, 2014 01:16
kitchen diagnose chef-client-test-centos-65
---
timestamp: 2014-11-07 01:14:47.029690000 Z
kitchen_version: 1.2.1
instances:
chef-client-test-centos-65:
state_file:
hostname: 127.0.0.1
last_action: create
port: '2222'
ssh_key: /Users/cdoherty/.vagrant.d/insecure_private_key
PS C:\Users\Chris Doherty\chef> bundle exec chef-client -z -r 'recipe[dsc-test]'
DL is deprecated, please use Fiddle
[2014-12-15T20:08:26-08:00] WARN: No config file found or specified on command line, using command line options.
Starting Chef Client, version 12.1.0.dev.0
resolving cookbooks for run list: ["dsc-test"]
Synchronizing Cookbooks:
- dsc-test
Compiling Cookbooks...
Converging 1 resources
Recipe: dsc-test::default
@randomcamel
randomcamel / gist:b10f1db445eb842931de
Created March 11, 2015 16:23
pg gem build failure with Chef 12.1.1
find_executable: checking for pg_config... -------------------- yes
--------------------
find_header: checking for libpq-fe.h... -------------------- yes
"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/usr/include/postgresql -I/opt/chef/embedded/include -O3 -g -pipe -I/opt/chef/embedded/include -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c -L. -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L/usr/lib -Wl,-R/usr/lib -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L. -Wl,-rpath,/opt/chef/embedded/lib -fstack-protector -L/opt/chef/embedded/lib -rdynamic -Wl,-export-dynamic -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -Wl,-R -Wl,/opt/chef/embedded/lib -L/opt/chef/embedded/lib -lruby -lpthread -lrt -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"