Skip to content

Instantly share code, notes, and snippets.

Lorenzo Bolla lbolla

Block or report user

Report or block lbolla

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View newrelic-tornado6.py
# Run the server with:
# $> newrelic-admin run-python newrelic-tornado6.py --logging=debug
# Hit the server with:
# $> curl http://localhost:8888/
# Note the error in the server logs
import tornado.httpclient
import tornado.ioloop
from tornado.options import parse_command_line
View mypy-checkers.py
import re
line = 'filename.py:24: error: Dict entry 0 has incompatible type "str": "str"; expected "int": "str"'
output_matcher = re.compile(
r'(?P<filename>[^:]+):'
r'(?P<line_number>[^:]+):'
r'((?P<column_number>[^:]+):)?' # Column number is optional, depending on mypy options
r' (?P<level>[^:]+):'
r' (?P<description>.+)$')
View socket_timeout_0
~/src/cherrypy-lbolla(master*) » hey -c 5 -n 1000 http://127.0.0.1:8888/
Summary:
Total: 1.8755 secs
Slowest: 0.0195 secs
Fastest: 0.0013 secs
Average: 0.0093 secs
Requests/sec: 533.1808
Total data: 144000 bytes
View pipe.py
from functools import partial
class Infix(object):
def __init__(self, func):
self.func = func
def __or__(self, other):
return self.func(other)
View queues.py
import time
import multiprocessing.queues
from Queue import Empty
import futures
q = multiprocessing.queues.Queue()
N = 10000
M = 4
timeout = 1
@lbolla
lbolla / bench_excel_writers.py
Last active Mar 10, 2016 — forked from jmcnamara/bench_excel_writers.py
Benchmark of several Python Excel writing modules
View bench_excel_writers.py
##############################################################################
#
# Simple Python program to benchmark several Python Excel writing modules.
#
# python bench_excel_writers.py [num_rows] [num_cols]
#
#
import sys
import resource
View alloc.py
import gc
import os
import resource
def print_mem():
u = resource.getrusage(resource.RUSAGE_SELF)
print 'N={} RSS={}'.format(N, u.ru_maxrss)
View flycheck-checker-erlang-dializer
(flycheck-define-checker erlang-dialyzer
"Erlang syntax checker based on dialyzer."
:command ("dialyzer" source-original)
:error-patterns
((error line-start
(file-name)
":"
line
":"
(message)
View javascript_flow_checker.el
(flycheck-define-checker javascript-flow
"A JavaScript syntax and style checker using Flow.
See URL `http://flowtype.org/'."
:command ("flow" source-original)
:error-patterns
((error line-start
(file-name)
":"
line
View pickle_experiments.py
import StringIO
import cPickle
small = [{i: i} for i in xrange(9)]
medium = [{i: i} for i in xrange(999)]
large = [{i: i} for i in xrange(999999)]
def dumps(obj):
return cPickle.dumps(obj)
You can’t perform that action at this time.