Skip to content

Instantly share code, notes, and snippets.

View minrk's full-sized avatar

Min RK minrk

View GitHub Profile
import os
import time
import json
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import os
import time
import json
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
#!/usr/bin/env python
# -*- encoding: utf-8
#from IPython.external
import sys
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser()
paa = parser.add_argument
def send_apply_message(self, socket, f, args=None, kwargs=None, subheader=None, track=False,
ident=None):
"""construct and send an apply message via a socket"""
assert not self._closed, "cannot use me anymore, I'm closed!"
# defaults:
args = args if args is not None else []
kwargs = kwargs if kwargs is not None else {}
subheader = subheader if subheader is not None else {}
diff --git a/setup.py b/setup.py
index f6c7e99..75bd22f 100755
--- a/setup.py
+++ b/setup.py
@@ -189,7 +189,6 @@ if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
packages = find_packages()
package_data = find_package_data()
-scripts = find_scripts()
data_files = find_data_files()
import socket
def flush(s, buf=1024):
"""recv the most recent message, ignoring queued values"""
# save timeout
to = s.gettimeout()
# recv first message in blocking manner
msg = s.recv(buf)
s.settimeout(0)
while True:
# override ioloop.IOLoop with zmq's IOLoop
import sys
import tornado.ioloop
from zmq.eventloop import ioloop
tornado.ioloop.IOLoop = ioloop.IOLoop
import trombi
loop = ioloop.IOLoop.instance()
# check that tornado's ioloop instance is actually zmq's
kv_pattern = re.compile(r'\w+\.[\w\.]+\w\=.+')
macro_pattern = re.compile(r'\-\-\w[\w\-]+')
class KeyValueConfigLoader(CommandLineConfigLoader):
"""A config loader that loads key value pairs from the command line.
This allows command line options to be gives in the following form::
ipython Global.profile="foo" InteractiveShell.autocall=False
"""
#!/usr/bin/env ruby
# a script for graphing first non-italic non-parenthetical link paths on wikipedia
# per http://www.xkcd.com/903
#
require 'rubygems'
require 'mechanize'
require 'rgl/adjacency'
require 'rgl/dot'
require 'rgl/traversal'
import re
from string import uppercase
import numpy as np
from matplotlib import pyplot as plt
dt = [('name', 'a32'), ('gender', 'a1'), ('count', int), ('freq', float), ('year', int)]
def fetch_names(dest='names.zip'):