Skip to content

Instantly share code, notes, and snippets.

View graphex's full-sized avatar

Sean McKibben graphex

  • Boulder, Colorado
View GitHub Profile
@graphex
graphex / CopyKey.go
Created October 23, 2013 23:07
Copying Riak Keys with Indexes. Indexes not being populated on destination Riak.
func (c *Copier) CopyKey(bucket string, key string) bool {
obj, err := c.SrcRiak.FetchObject(bucket, key)
if err != nil {
log.Printf("Unable to get /%v/%v Error:%v", bucket, key, err.Error())
return false
}
log.Printf("\n\nSource:\n")
log.Printf("\n/buckets/%v/keys/%v\n", bucket, key)
log.Println(string(obj.GetContent()[0].GetValue()))
log.Println(obj.GetContent()[0].GetIndexes())
@graphex
graphex / gist:5922686
Created July 3, 2013 20:49
Time Zone Identifiers
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
@graphex
graphex / gist:5305274
Created April 3, 2013 21:03
Riak PBC error
>> RIAK_HTTP_CLIENT.bucket("test_bucket").get_index("c_bin","test")
=> ["my_token"]
>> RIAK_PBC_CLIENT.bucket("test_bucket").get_index("c_bin","test")
NoMethodError: undefined method `length' for #<Riak::Bucket {test_bucket}>
from /Users/graphex/.rvm/gems/jruby-1.7.2@gemset/gems/beefcake-0.3.7/lib/beefcake/buffer/encode.rb:108:in `append_string'
from org/jruby/RubyBasicObject.java:1665:in `__send__'
from /Users/graphex/.rvm/gems/jruby-1.7.2@gemset/gems/beefcake-0.3.7/lib/beefcake/buffer/encode.rb:13:in `append'
from /Users/graphex/.rvm/gems/jruby-1.7.2@gemset/gems/beefcake-0.3.7/lib/beefcake.rb:102:in `encode!'
from org/jruby/RubyArray.java:1613:in `each'
from /Users/graphex/.rvm/gems/jruby-1.7.2@gemset/gems/beefcake-0.3.7/lib/beefcake.rb:90:in `encode!'
@graphex
graphex / gist:3918870
Created October 19, 2012 15:33
Sitrep for celluloid
class Sitrep
include Celluloid
def initialize
log_sitrep
end
def log_sitrep
Celluloid.logger.debug "\nActors:\n" + (Celluloid::Actor.all.to_set.map { |a|
retval = nil
@graphex
graphex / gist:3696436
Created September 11, 2012 06:18
Celluloid Presentation Code
require 'celluloid'
class SayActor
include Celluloid
VOICES = %w(Daniel Emily Fiona Jill Karen Lee Moira Samantha Sangeeta Serena Tessa Tom)
def initialize(voice=nil)
@voice = voice.blank? ? VOICES.shuffle[0] : voice
end
def say(text)
NoMethodError: undefined method `alive?' for #<Celluloid::Actor:0x007f9cb9dd93b8>
/Users/graphex/.rvm/gems/ruby-1.9.3-p194@cellar/gems/celluloid-0.12.0/lib/celluloid.rb:245:in `alive?'
/Users/graphex/Documents/Client/Graphex/Cellar/lib/director.rb:36:in `puts_env_info'
/Users/graphex/Documents/Client/Graphex/Cellar/lib/director.rb:32:in `say_pool'
/Users/graphex/.rvm/gems/ruby-1.9.3-p194@cellar/gems/celluloid-0.12.0/lib/celluloid/calls.rb:57:in `dispatch'
/Users/graphex/.rvm/gems/ruby-1.9.NoMethodError: undefined method `alive?' for #<Celluloid::Actor:0x007f9cb9dd93b8>
from /Users/graphex/.rvm/gems/ruby-1.9.3-p194@cellar/gems/celluloid-0.12.0/lib/celluloid.rb:245:in `alive?'
from /Users/graphex/Documents/Client/Graphex/Cellar/lib/director.rb:36:in `puts_env_info'
from /Users/graphex/Documents/Client/Graphex/Cellar/lib/director.rb:32:in `say_pool'
from /Users/graphex/.rvm/gems/ruby-1.9.3-p194@cellar/gems/celluloid-0.12.0/lib/celluloid/calls.rb:57:in `dispatch'
@graphex
graphex / gist:3556626
Created August 31, 2012 18:03
Basic riak functions in a threadsafe jello mold?
require 'riak/client'
require 'celluloid'
require 'airbrake'
class RiakClientActor
include Celluloid
def initialize()
#@statsd = Stat::get_new
@rc = Riak::Client.new(APP_CONFIG[:riak])
#!/usr/bin/env ruby
#
# Worker Pool example
#
# Looking for a way to light up all your cores? This is it! Celluloid::Worker
# lets you create fixed-sized thread pools for executing expensive background
# processing tasks.
PARALLEL_RUBIES = %w(jruby rbx)