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 logging | |
import multiprocessing | |
import os | |
import random | |
import threading | |
import time | |
from typing import Optional | |
LOG_FMT = ('%(asctime)s %(levelname)s [%(name)s] ' | |
'<%(filename)s:%(funcName)s:%(lineno)d> ' |
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
# 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 |
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 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>.+)$') |
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
~/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 |
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
from functools import partial | |
class Infix(object): | |
def __init__(self, func): | |
self.func = func | |
def __or__(self, other): | |
return self.func(other) |
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 | |
import multiprocessing.queues | |
from Queue import Empty | |
import futures | |
q = multiprocessing.queues.Queue() | |
N = 10000 | |
M = 4 | |
timeout = 1 |
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
############################################################################## | |
# | |
# Simple Python program to benchmark several Python Excel writing modules. | |
# | |
# python bench_excel_writers.py [num_rows] [num_cols] | |
# | |
# | |
import sys | |
import resource |
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 gc | |
import os | |
import resource | |
def print_mem(): | |
u = resource.getrusage(resource.RUSAGE_SELF) | |
print 'N={} RSS={}'.format(N, u.ru_maxrss) | |
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
(flycheck-define-checker erlang-dialyzer | |
"Erlang syntax checker based on dialyzer." | |
:command ("dialyzer" source-original) | |
:error-patterns | |
((error line-start | |
(file-name) | |
":" | |
line | |
":" | |
(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
(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 |
NewerOlder