This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Example Usage: | |
from buildbot.status import messagepub | |
c['status'].append(messagepub.Notifier(recipient="a@b.c", key="Your messagepub key")) | |
''' | |
import urllib, base64 | |
from zope.interface import implements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for file in `find . -type f`; do echo $file `cat $file | wc -l`; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "java" | |
require "ClojureLibrary.jar" | |
require "clojure-1.0.0.jar" | |
include_class "org.jruby.clojure.ClojureLibrary" | |
clj_lib = ClojureLibrary.new | |
clj_lib.load(JRuby.runtime, true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "java" | |
require "jetlang-0.2.0.jar" | |
include_class "org.jetlang.fibers.ThreadFiber" | |
include_class "org.jetlang.channels.MemoryChannel" | |
class Arnie | |
def initialize(channel, consumer) | |
@channel = channel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use 'clojure.test) | |
(defn concat-elements [x y] | |
(cond (empty? x) (apply str (concat "-" y)) | |
(empty? y) (apply str (concat x "-")) | |
:else (apply str(concat x y)))) | |
(defn glom [x] | |
(remove #(empty? %) | |
(seq (.split (apply str (reduce concat-elements x)) "-")))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "test/unit" | |
class GlomTest < Test::Unit::TestCase | |
def glom(l) | |
l.inject([""]) do |r,x| | |
r << "" if x.empty? | |
r.last << x | |
r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from eventlet import coros | |
from eventlet.green import urllib2 | |
def fetch(url): | |
print "%s fetching %s" % (time.asctime(), url) | |
data = urllib2.urlopen(url) | |
print "%s fetched %s" % (time.asctime(), data.read()) | |
def load(url, pool_size): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "neverblock" | |
require "eventmachine" | |
require "net/http" | |
require "uri" | |
def load_timer(url, number_of_requests=50) | |
start = Time.now | |
EM.run do | |
@pool = NB::Pool::FiberPool.new(number_of_requests) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspired fromCorey Goldberg's load gen work. | |
import sys | |
import time | |
import socket | |
from threading import Thread | |
host = '127.0.0.1' | |
port = 21567 | |
data = "This is a test packet" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EventMachine.run do | |
couch = EventMachine::Protocols::CouchDB.connect :host => 'localhost', :port => 5986 | |
couch.get_all_dbs {|dbs| puts dbs} | |
couch.create_db("test-project") | |
couch.get_all_dbs {|dbs| puts dbs} | |
couch.get_db("test-project") do |db| | |
puts db | |
couch.save(db["db_name"], {:name => "couchd", "description" => "awesome"}) do |doc| | |
couch.get(db["db_name"], doc["id"]) do |doc| | |
puts doc |
NewerOlder