Skip to content

Instantly share code, notes, and snippets.

@pradeepgatram
pradeepgatram / gist:3403014
Created August 20, 2012 10:34
Random password generator
pwd = ""; 5.times {|i| pwd += (rand(26)+97).chr};pwd += "." + rand(100000).to_s
#...
mq = MQ.new
mq.prefetch(1) # fetching only one message at a time
bound_q = mq.queue(AMQP_CONFIG[:subscriber_queue_for_store_data])
#...
# written by Pradeep Gatram, www.masplantiz.com
# no restrictions whatsoever on usage.
require 'rubygems'
require 'mq'
EM.run do
def replicate source, destination, topic
source_q = MQ::Queue.new(source, "replicator for #{topic}")
source_q.bind(MQ::Exchange.new(source, :topic, topic))