Skip to content

Instantly share code, notes, and snippets.

View chrisking's full-sized avatar

Chris King chrisking

View GitHub Profile
@chrisking
chrisking / cdn.log
Created April 22, 2016 18:13
Performance monitoring
root@ubuntu:~# ab -n 1000 -c 100 http://docs.python-requests.org/en/v3.0.0/
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking docs.python-requests.org (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
[18/Feb/2016 08:36:14] DEBUG [django.db.backends:91] (0.002) SELECT "company_url"."id", "company_url"."url", "company_url"."company_id", "company_url"."recurse", "company_url"."created" FROM "company_url" INNER JOIN "company_companyupload_urls_added" ON ( "company_url"."id" = "company_companyupload_urls_added"."url_id" ) WHERE "company_companyupload_urls_added"."companyupload_id" = 4; args=(4,)
[18/Feb/2016 08:38:26] DEBUG [django.db.backends:91] (0.007)
SELECT c.relname
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind IN ('r', 'v', '')
AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
AND pg_catalog.pg_table_is_visible(c.oid); args=None
[18/Feb/2016 08:38:26] DEBUG [django.db.backends:91] (0.016) SELECT "django_migrations"."app", "django_migrations"."name" FROM "django_migrations"; args=()
[18/Feb/2016 08:38:26] DEBUG [django.db.backends:91] (0.002)
@chrisking
chrisking / output.text
Created January 9, 2016 21:20
test output
(ddm_apps)➜ ddm_apps git:(crawler_test_coverage_206) django-admin.py test
Creating test database for alias 'default'...
.....E.....E..............................................................................................................................................
======================================================================
ERROR: test_dump_pending_os_error (ddm_apps.apps.crawl.test_crawl.CrawlerTester)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/chris/.virtualenvs/ddm_apps/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
return func(*args, **keywargs)
File "/Users/chris/projects/ddm_apps/apps/crawl/test_crawl.py", line 371, in test_dump_pending_os_error
@chrisking
chrisking / helper.py
Created November 16, 2015 19:04
python help
for messages in calls:
if "creating new document" in messages:
self.assertTrue(True)
else:
self.assertTrue("creating new key" in messages)
@chrisking
chrisking / VagrantFile.rb
Created November 10, 2015 19:37
VagrantFile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@chrisking
chrisking / fstab
Created October 22, 2015 19:38
CIFS FSTAB entry for linux
mount -t cifs //server.domain.com/SHARE_NAME -o username=USERNAME,password=PASSWORD,rw,nounix,iocharset=utf8,file_mode=0644,dir_mode=0755 /desired/location/CIFSMOUNT/
Environment:
Request Method: GET
Request URL: http://staging.datadecisionmodels.com/harness/index/execute/dispatch/
Django Version: 1.7.1
Python Version: 2.7.6
Installed Applications:
('django.contrib.auth',
@chrisking
chrisking / user_data_parser.py
Created February 18, 2015 12:06
user_data_parser.py
import requests
user_data = requests.get('http://169.254.169.254/latest/user-data')
if user_data.status_code == 200:
user_data = user_data.json()
flavor = user_data.json()['flavor']
if flavor == "indexer":
local("fab start_indexing")
elif flavor == "crawler":
local("fab start_crawling")
elif flavor == "inferer":
[[2014, "http/com/apexep/www/directions.html"], [2013, "http/com/apexep/www/surplus-equipment.htm"], [2012, "http/com/apexep/www/pwi"], [2011, "http/com/apexep/www/feedback.php"], [2010, "http/com/apexep/www/company-news.html"], [2009, "http/com/apexep/www"]]
@chrisking
chrisking / messages.json
Created January 16, 2015 16:41
JSON Message Format
[[0,"/some/url/s3/stuff"],[34,"/another/s3/url"]]
// Instead of
["/some/urls","another/urls"]