Skip to content

Instantly share code, notes, and snippets.

View dmitchell's full-sized avatar

Don Mitchell dmitchell

View GitHub Profile
@dmitchell
dmitchell / cargurus-interview.sql
Last active March 16, 2017 19:08
sql phone screen question
create table keywords
(
id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
campaign_id INT
);
create table campaign
(
id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar
@dmitchell
dmitchell / batch.json
Last active February 22, 2017 17:31
batch op for fb
{"batch":"[{\"method\":\"post\",\"relative_url\":\"act_10158095527450599/adcreatives\",\"body\":\"name=atv206-image1-&object_story_spec=%7B%22link_data%22%3A%7B%22call_to_action%22%3A%7B%22type%22%3A%22SHOP_NOW%22%2C%22value%22%3A%7B%22link%22%3A%22https%3A%2F%2Fwww.cargurus.com%2FCars%2Finventorylisting%2FviewDetailsFilterViewInventoryListing.action%3Fax8324%3D26624540%26cgagid%3D8671777%26cgcid%3D5497%26px8324%3Dp5%26sourceContext%3Dprospecting%26utm_campaign%3Dprospecting%26utm_medium%3Dcpc%26utm_source%3Dfacebook%22%7D%7D%2C%22message%22%3A%22Car+shop+with+confidence.+CarGurus+helps+you+find+the+best+deals+from+top-rated+local+dealers%21%22%2C%22link%22%3A%22https%3A%2F%2Fwww.cargurus.com%2FCars%2Finventorylisting%2FviewDetailsFilterViewInventoryListing.action%3Fax8324%3D26624540%26cgagid%3D8671777%26cgcid%3D5497%26px8324%3Dp5%26sourceContext%3Dprospecting%26utm_campaign%3Dprospecting%26utm_medium%3Dcpc%26utm_source%3Dfacebook%22%2C%22name%22%3A%22Let+Us+Help+You+Find+the+Best+Deal%22%2C%22description%22%
@dmitchell
dmitchell / gist:2f6c458d5eb64f30678a
Last active August 29, 2015 14:07
GridFS auth failure on Jenkins
File "/home/jenkins/workspace/edx-all-tests-auto-pr/SHARD/1/TEST_SUITE/bok-choy/common/lib/xmodule/xmodule/contentstore/mongo.py", line 40, in __init__
_db.authenticate(user, password)
File "/home/jenkins/edx-venv/local/lib/python2.7/site-packages/pymongo/database.py", line 902, in authenticate
self.connection._cache_credentials(self.name, credentials)
File "/home/jenkins/edx-venv/local/lib/python2.7/site-packages/pymongo/mongo_client.py", line 459, in _cache_credentials
auth.authenticate(credentials, sock_info, self.__simple_command)
File "/home/jenkins/edx-venv/local/lib/python2.7/site-packages/pymongo/auth.py", line 243, in authenticate
auth_func(credentials[1:], sock_info, cmd_func)
File "/home/jenkins/edx-venv/local/lib/python2.7/site-packages/pymongo/auth.py", line 222, in _authenticate_mongo_cr
cmd_func(sock_info, source, query)
@ddt.ddt
class OutlinePerfTest(TestCourseOutline):
def setUp(self):
with modulestore().default_store(ModuleStoreEnum.Type.split):
super(OutlinePerfTest, self).setUp()
@ddt.data(1, 2, 4, 8)
def test_query_counts(self, num_threads):
"""
Test that increasing threads does not increase query counts
"<problem>\n <p>\n A JSDraw problem lets the user use the JSDraw editor component to draw a\n new molecule or update an existing drawing and then submit their work. \n Answers are specified as SMILES strings.\n </p>\n <p>\n I was trying to draw my favorite molecule, caffeine. Unfortunately,\n I'm not a very good biochemist. Can you correct my molecule?\n </p>\n <jsdrawresponse>\n <!-- You can set initial state of the editor by including a molfile\n inside of the jsdraw tag. Take care that indentation is preserved.\n The molfile format is sensitive to whitespace. -->\n <jsdraw>\n JSDraw201081410342D\n\n 12 13 0 0 0 0 0 V2000\n 12.0000 -6.7600 0.0000 N 0 0 0 0 0 0 0\n 10.6490 -5.9800 0.0000 C 0 0 0 0 0 0 0\n 10.6490 -4.4200 0.0000 N 0 0 0 0 0 0 0\n 12.0000 -3.6400 0.0000 C 0 0 0 0 0 0 0\n 13.3510 -4.4200 0.0000 C 0 0 0 0 0 0