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
def code = null | |
def message = "error message" | |
def builder = new JsonBuilder() | |
def root = builder { | |
error( | |
code: code ?: "", | |
message: message ?: "" | |
) |
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 zmq | |
context = zmq.Context() | |
sub = context.socket(zmq.SUB) | |
sub.setsockopt(zmq.SUBSCRIBE, "") | |
sub.connect("tcp://127.0.0.1:5555") | |
while True: | |
print "recv:", sub.recv() |
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 zmq | |
import time | |
context = zmq.Context() | |
pub = context.socket(zmq.PUB) | |
pub.bind("tcp://127.0.0.1:5555") | |
c = 0 | |
while True: | |
msg = "[" + str(c) + "]" |
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 zmq | |
context = zmq.Context() | |
req = context.socket(zmq.REQ) | |
req.connect("tcp://127.0.0.1:5555") | |
while True: | |
c += 1 | |
msg = "%s" % c | |
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 zmq | |
import time | |
context = zmq.Context() | |
rep = context.socket(zmq.REP) | |
rep.bind("tcp://127.0.0.1:5555") | |
while True: | |
request = rep.recv() | |
print "recieved request: [%s]" % request |
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
line = "" | |
f1 = open(ARGV[0]) | |
f2 = open(ARGV[0] + ".csv", "w") | |
f1.gets | |
f1.gets | |
while l = f1.gets | |
if l != "" | |
l.gsub!(/\s+/, ",") |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys, time, threading, abc | |
from optparse import OptionParser | |
def parse_options(): | |
parser = OptionParser() | |
parser.add_option("-t", action="store", type="int", dest="threadNum", default=1, | |
help="thread count [1]") |