Skip to content

Instantly share code, notes, and snippets.

View krobertson's full-sized avatar

Ken Robertson krobertson

View GitHub Profile
@krobertson
krobertson / gist:31593
Created December 3, 2008 16:01
DataMapper 0.9.7 Marshal.dump Test
require 'rubygems'
require 'dm-core'
DataMapper.setup(:default, 'sqlite3::memory:')
class Dummy
include DataMapper::Resource
property :id, Serial
property :name, String
end
@krobertson
krobertson / handler.rb
Created January 1, 2009 19:12
rackdav
#
# rackdav (prototype) by Ken Robertson
#
# rackdav is a work in progress of a Rack middleware implementation of WebDAV
#
# This code is barely functional and ugly as hell, but meant to just work on figuring out compliance.
# It is built by working through the test suite provided by litmus (http://www.webdav.org/neon/litmus)
# Once it has compliance on the commands, it will be greatly cleaned up and refactored into an actual
# library instead of a gist.
#
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/bluepill-0.0.15/bin/../lib/bluepill/application.rb:15:in `initialize': undefined method `+' for nil:NilClass (NoMethodError)
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/bluepill-0.0.15/bin/../lib/bluepill/controller.rb:34:in `new'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/bluepill-0.0.15/bin/../lib/bluepill/controller.rb:34:in `send_cmd'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/bluepill-0.0.15/bin/bluepill:59
from /opt/ree/bin/bluepill:19:in `load'
from /opt/ree/bin/bluepill:19
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/bluepill-0.0.15/bin/../lib/bluepill/application.rb:136:in `send_to_server': undefined local variable or method `buffer' for #<Bluepill::Application:0x9a7e9b0> (NameError)
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/bluepill-0.0.15/bin/../lib/bluepill/application.rb:73:in `status'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/bluepill-0.0.15/bin/../lib/bluepill/controller.rb:35:in `send'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/bluepill-0.0.15/bin/../lib/bluepill/controller.rb:35:in `send_cmd'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/bluepill-0.0.15/bin/bluepill:59
from /opt/ree/bin/bluepill:19:in `load'
from /opt/ree/bin/bluepill:19
@krobertson
krobertson / gist:233480
Created November 13, 2009 00:58
Ruby SMTP to XMPP server/gateway
require 'gserver'
require 'rubygems'
require 'xmpp4r'
require 'xmpp4r/roster'
require 'daemons'
JABBER_USER = 'service@domain.com'
JABBER_PASS = 'secret'
EMAIL_DOMAIN = 'domain.com'
require 'rubygems'
require 'dm-core'
require 'dm-timestamps'
DataMapper.setup(:default, "sqlite3:///#{Dir.pwd}/test.db")
class User
include DataMapper::Resource
property :id, Serial
g++ -DPACKAGE_NAME=\"scribe\" -DPACKAGE_TARNAME=\"scribe\" -DPACKAGE_VERSION=\"1.5.0\" -DPACKAGE_STRING=\"scribe\ 1.5.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"scribe\" -DVERSION=\"1.5.0\" -DHAVE_BOOST= -DHAVE_BOOST_SYSTEM= -DHAVE_BOOST_FILESYSTEM= -I. -I.. -I/usr/local/include -I/usr/local/include/thrift -I/usr/local/include/thrift -I/usr/local/include/thrift/fb303 -I/usr/local/include -I/usr/include -Wall -O3 -MT store.o -MD -MP -MF .deps/store.Tpo -c -o store.o store.cpp
In file included from env_default.h:24,
from common.h:57,
from store.cpp:28:
/usr/local/include/thrift/server/TNonblockingServer.h:33:19: error: event.h: No such file or directory
In file included from env_default.h:24,
from common.h:57,
from store.cpp:28:
/usr/local/include/thrift/server/TNonblockingServer.h:93: error: expected ‘;’ before ‘*’ token
#!/usr/bin/env ruby
require 'jruby/vm'
vms = []
queue = 'background_tasks_LP'
instance_count = 30
Signal.trap('HUP') { vms.map(&:join) }
HTTP/1.1 200 ...
Server: nginx/0.7.65
Date: Wed, 12 Jan 2011 23:59:05 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Content-Encoding: gzip
Transfer-Encoding: chunked
Vary: Accept-Encoding
@krobertson
krobertson / launchd.rb
Created July 2, 2011 15:12 — forked from raggi/launchd.rb
A first stab at a launchd provider for chef
class Chef::Provider::Service::Launchd < Chef::Provider::Service::Simple
LAUNCHCTL_FORMAT = /([\d-]+)\s+([\d-]+)\s+([[:print:]]+)/
def initialize(new_resource, run_context)
raise ArgumentError, "run_context cannot be nil" unless run_context
super
run_context.node
end