This file contains hidden or 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 sys | |
import gevent | |
import timeit | |
from gevent.event import Event | |
from plotter import graph_latency, graph_ops | |
RUNS = [100, 500, 1000, 5000, 10000, 20000, 30000, 60000, 100000, 120000, 150000] | |
start_event = Event() | |
greenlets = [] | |
times = [] |
This file contains hidden or 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 connect(args): | |
con = initialize(args['NAME'], karma=0.001) | |
con.simple_bind_s(args['USER'], args['PASSWORD']) | |
return con | |
pool = DBPool.ConnectionPool( | |
connect, { | |
'NAME': 'ldap://ldapserver', | |
'USER': 'xxxxxxx', | |
'PASSWORD': 'xxxxx', |
This file contains hidden or 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
class DatabaseWrapper(BaseDatabaseWrapper): | |
SEARCH_PAGE_SIZE=999 | |
def __init__(self, *args, **kwargs): | |
super(DatabaseWrapper, self).__init__(*args, **kwargs) | |
self.charset = "utf-8" | |
self.creation = DatabaseCreation(self) | |
self.features = DatabaseFeatures(self) | |
if django.VERSION > (1, 4): | |
self.ops = DatabaseOperations(self) |
This file contains hidden or 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
""" | |
::Eagle Eye Networks Inc.::: | |
::Python screening:: | |
The following script is purposley written poorly. | |
Fix the 'magic' function. | |
""" | |
def magic(X, additional=[]): |
This file contains hidden or 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
""" | |
::Eagle Eye Networks Inc.::: | |
::Python screening:: | |
The 'has_dups' function checks an array for | |
duplicate strings. It's pretty inefficient. | |
Improve the 'has_dups' function and explain | |
how you improved it. | |
""" |
This file contains hidden or 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
""" | |
::Eagle Eye Networks Inc.::: | |
::Python screening:: | |
The "SummertimeService" will drive you insane. | |
It throws random errors. Summertime it works | |
summertime it don't. | |
Some errors you can ignore and assume worked, | |
others you need to reset the service. |
This file contains hidden or 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
""" | |
::Eagle Eye Networks Inc.::: | |
::Python screening:: | |
The following script is purposley written poorly. | |
The City class depends on an external service that is really | |
slow. Improve the code below so that 'test1' is more performant | |
but preserves: | |
- the ability to get a City as a dict or string. |
This file contains hidden or 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
""" | |
::Eagle Eye Networks Inc.::: | |
::Python screening:: | |
The following script is purposley written poorly. | |
Improve upon the code and explain your improvements. | |
The id_csv method must return a unicode string of | |
representation of a comma separated list of uuid's | |
""" |
This file contains hidden or 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 dhashpy | |
_dhash = None | |
_host = None | |
_port = None | |
class DHash(object): | |
"""Wrap the dhashpy to make the simple things simpler""" | |
def __init__(self, dhash): |
This file contains hidden or 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 requests | |
import datetime | |
import calendar | |
import json | |
token = "------------" | |
project_id= "--------------" | |
iron_host = "worker-aws-us-east-1.iron.io/2/projects/%s" % project_id |