Skip to content

Instantly share code, notes, and snippets.

View jaredlockhart's full-sized avatar

Jared Lockhart jaredlockhart

View GitHub Profile
ubuntu@cloudvm~/page-metadata-parser(master)$ npm run test | gist
No coverage information was collected, exit without writing coverage information
/home/ubuntu/page-metadata-parser/tests/test_metadata.js:78
});
^
SyntaxError: Unexpected end of input
at Object.exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:513:28)
at Object.Module._extensions..js (module.js:550:10)
at Object.Module._extensions.(anonymous function) [as .js] (/home/ubuntu/page-metadata-parser/node_modules/istanbul/lib/hook.js:109:37)
In [83]: pprint.pprint(json.loads(requests.post('http://cloudvm.jaredkerim.com/', data=json.dumps({'urls': ['https://news.ycombinator.com']}), headers={'content-type':'application/json'}).content))
{u'error': u'',
u'urls': {u'https://news.ycombinator.com': {u'favicon_colors': [{u'color': [252,
100,
4],
u'weight': 0}],
u'favicon_url': u'https://news.ycombinator.com/favicon.ico',
u'image': u'https://news.ycombinator.com/y18.gif',
u'images': [{u'colors': [{u'color': [0,
0,
{"urls": [{"url": "http://www.slate.com/articles/health_and_science/science/2016/07/there_s_a_key_difference_between_how_christian_and_muslim_creationists_see.html", "timestamp": 1467383640000}, {"url": "http://fivethirtyeight.com/features/even-with-kevin-durant-the-warriors-probably-wont-win-73-games-again/", "timestamp": 1467608400000}, {"url": "http://www.vox.com/2016/7/1/12051622/brexit-vote-age-gap-aging-science-psychology", "timestamp": 1467384600000}, {"url": "https://medium.com/@flyosity/building-my-1-200-hackintosh-49a1a186241e#.xm6j3uz6b", "timestamp": 0}, {"url": "https://www.buzzfeed.com/lukebailey/the-crisis-explained-maybe", "timestamp": 0}, {"url": "http://www.nytimes.com/2016/07/06/upshot/helpless-to-prevent-cancer-actually-a-lot-is-in-your-control.html", "timestamp": 1467726300000}, {"url": "http://www.newyorker.com/culture/culture-desk/my-struggle-with-american-small-talk", "timestamp": 1467608400000}, {"url": "https://medium.com/@yegg/mental-models-i-find-repeatedly-useful-936f1cc405d", "t
# 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 [9]: pprint.pprint(json.loads(requests.post('http://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))
{u'error': u'',
u'urls': {u'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/': {u'description': u'Google search history suggests many Britons had little idea what they were voting for.',
u'favicon_url': u'https://www.washingtonpost.com/favicon.ico',
u'image_url': u'https://img.washingtonpos
> fetch("http://metadata.dev.mozaws.net/", {
... method: "POST",
... mode: "no-cors",
... headers: {"content-type": "application/json"},
... body: data}).then((r) => r.json()).then(console.log)
Promise { <pending> }
> { error: '',
urls:
{ 'http://cs.ubc.ca':
{ description: 'UBC Computer Science is one of the top computer science departments in Canada, known for excellence in both research and teaching.',
In [107]: print requests.post('http://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
{"error":"","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/":{"description":"Google search history suggests many Britons had little idea what they were voting for.","image_url":"https://img.washingtonpost.com/rf/image_1484w/2010-2019/Wires/Images/2016-06-24/AP/Britain_EU-f57a6.jpg","title":"The British are frantically Googling what the E.U. is, hours after voting to leave it","type":"article","url":"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/","original_url":"https://www.washingtonpost.com/news/the-switch/wp/2016/06/
In [107]: print requests.post('http://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
{
"error":"",
"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/":{
"description":"Google search history suggests many Britons had little idea what they were voting for.",
"image_url":"https://img.washingtonpost.com/rf/image_1484w/2010-2019/Wires/Images/2016-06-24/AP/Britain_EU-f57a6.jpg",
"title":"The British are frantically Googling what the E.U. is, hours after voting to leave it",
"type":"article",
.map(link => {
return Object.assign({}, link, {
sanitized_url: this._sanitizeURL(link.url),
cache_key: this._createCacheKey(sanitizedURL)
});
})
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: