Skip to content

Instantly share code, notes, and snippets.

View jaredlockhart's full-sized avatar

Jared Lockhart jaredlockhart

View GitHub Profile
With ss, no history, 1 recommendation:
Load Latency: 925
Load Latency: 919
Load Latency: 1080
Load Latency: 1063
Load Latency: 1000
With ss, front page of hackernews, 1 recommendation:
574 of 618 tests passed.
There were test failures...
The following tests failed:
./test/test-ActivityStreams-places-caching.test caching follows prefs: timed out, failure
./test/test-ActivityStreams-places-caching.test rebuilds don't clobber each other: failure
./test/test-ActivityStreams-private-browsing.test activity stream doesn't load in private windows: failure
./test/test-ActivityStreams-workers.test load worker: failure
./test/test-ActivityStreams-workers.test removing worker on url change: failure
./test/test-ActivityStreams-workers.test workers for page reload: failure
bash>
pip install requests ipython;ipython
ipython>
import requests, json
json.loads(requests.post('https://metadata.dev.mozaws.net/', data=json.dumps({'urls': ['https://www.washingtonpost.com/news/the-switch/wp/2016/06/24/the-british-are-frantically-googling-what-the-eu-is-hours-after-voting-to-leave-it/']}), headers={'content-type':'application/json'}).content)
# individual machine
docker-machine create -d amazonec2 \
--amazonec2-access-key=asdf \
--amazonec2-secret-key=asdf \
--amazonec2-region=us-east-1 \
--amazonec2-zone=c \
--amazonec2-vpc-id=asdf \
--amazonec2-subnet-id=asdf \
--amazonec2-instance-type="m4.xlarge" \
mymachine1
In [27]: fetch_metadata('http://www.discountjuicers.com/shipping.html')
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Out[27]:
{u'error': u'',
u'urls': {u'http://www.discountjuicers.com/shipping.html': {u'description': u'Lowest prices on juicers, dehydrators, sprouters and more! REALVIDEO demonstrations of juicers!',
u'favicon_url': u'http://www.discountjuicers.com/favicon.ico',
u'images': [],
u'original_url': u'http://www.discountjuicers.com/shipping.html',
u'title': u'Calculate UPS shipping rates for your order',
"
<html>
<head>
<meta name="thumbnail" content="/image.png" />
<link rel="icon" href="/favicon.ico" />
</head>
</html>
"
> ubuntu@cloudvm~/page-metadata-service/app(master)$ npm install request
page-metadata-service@0.3.0 /home/ubuntu/page-metadata-service/app
└─┬ request@2.74.0
├── aws-sign2@0.6.0
├── aws4@1.4.1
├── bl@1.1.2
├── caseless@0.11.0
├── forever-agent@0.6.1
├── har-validator@2.0.6
├─┬ hawk@3.1.3
e.message:
HALLO
console.log: activity-streams:
e.toString:
Error: HALLO
Design-driving demos
✓ handles a simple series of short-circuiting rules (55ms)
{ element: HTMLParagraphElement {},
score: 5,
flavors: Map { 'paragraphish' => { inlineLength: 16 } } }
[ HTMLParagraphElement {},
HTMLParagraphElement {},
HTMLDivElement {},
HTMLParagraphElement {} ]
1) takes a decent shot at doing Readability's job
function fetchUrlContent(url) {
return new Promise((resolve, reject) => {
const startFetch = statsdClient.getTimestamp();
fetch(url).then(res => {
const endFetch = statsdClient.getTimestamp();
statsdClient.timing('fetch_time', (endFetch - startFetch));
if (res.status >= 200 && res.status < 300) {
statsdClient.increment('fetch_success');