Skip to content

Instantly share code, notes, and snippets.

@peixian
Created August 30, 2016 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peixian/d4722477007f2c42d9c43ad10264bafd to your computer and use it in GitHub Desktop.
Save peixian/d4722477007f2c42d9c43ad10264bafd to your computer and use it in GitHub Desktop.
import json
import requests
story_str = 'https://hacker-news.firebaseio.com/v0/item/{}.json'
new_stories = requests.get('https://hacker-news.firebaseio.com/v0/newstories.json').json()
best_stories = requests.get('https://hacker-news.firebaseio.com/v0/beststories.json').json()
top_stories = requests.get('https://hacker-news.firebaseio.com/v0/beststories.json').json()
def get_titles(stories_list):
    for story in stories_list:
        uri = story_str.format(story)
        data = requests.get(uri).json()
        score = data['score']
        comments = len(data.get('kids')) if data.get('kids') else 0
        bikeshed = comments/score
        print('{0} - {1:.2f} - {2} comments, {3} score'.format(data['title'], bikeshed, comments, score))

get_titles(best_stories)
NSO Group's iPhone Zero-Days used against a UAE Human Rights Defender - 0.03 - 36 comments, 1045 score
Scammed By A Silicon Valley Startup - 0.07 - 85 comments, 1195 score
How I Built a Custom Camper Van (2015) - 0.12 - 87 comments, 701 score
“How do I choose not to share my account information with Facebook?” - 0.08 - 45 comments, 538 score
The Myth of RAM (2014) - 0.09 - 53 comments, 568 score
Amazon Vehicles - 0.12 - 56 comments, 472 score
Show HN: Top books mentioned in comments on Hacker News - 0.12 - 54 comments, 454 score
Academic Torrents: A distributed system for sharing enormous datasets - 0.04 - 19 comments, 536 score
Amazon is piloting teams with a 30-hour workweek - 0.11 - 38 comments, 360 score
Docker not ready for primetime - 0.11 - 51 comments, 485 score
4WD vs. AWD. What's the Difference? - 0.09 - 34 comments, 399 score
University of Chicago: ‘We Do Not Support So-Called Trigger Warnings’ - 0.09 - 40 comments, 435 score
Commission says Ireland granted undue tax benefits of up to €13B to Apple - 0.11 - 39 comments, 365 score
Breaking a myth: Data shows you don’t actually need a co-founder - 0.13 - 49 comments, 377 score
Gene Wilder Has Died - 0.08 - 30 comments, 375 score
Hunter S. Thompson on Finding Your Purpose (1958) - 0.06 - 31 comments, 511 score
USCIS Proposes Rule to Welcome International Entrepreneurs - 0.10 - 41 comments, 399 score
Facebook AI Research Team Open Source DeepMask and SharpMask - 0.04 - 16 comments, 364 score
Apollo Global is buying Rackspace for $4.3B - 0.08 - 28 comments, 338 score
Rotoscoped Animation of Filmed Parkour - 0.04 - 18 comments, 443 score
What I found wrong in Docker 1.12 - 0.09 - 35 comments, 383 score
In rich and poor countries, researchers turn to Sci-Hub - 0.08 - 26 comments, 324 score
Taking Over DigitalOcean Domains via a Lax Domain Import System - 0.08 - 31 comments, 384 score
GitHub Code Search – Programmers' Goldmine - 0.08 - 29 comments, 384 score
FreeNAS: Open Source Storage Operating System - 0.13 - 35 comments, 272 score
The Price of Solar Is Declining to Unprecedented Lows - 0.06 - 17 comments, 275 score
New class of galaxy has been discovered, made almost entirely of dark matter - 0.06 - 16 comments, 288 score
California bans ITT tech from accepting new students - 0.11 - 32 comments, 288 score
Victory for Net Neutrality in Europe - 0.04 - 11 comments, 257 score
How I built a Slack bot to help me find an apartment in San Francisco - 0.07 - 26 comments, 359 score
Uber Loses at Least $1.2B in First Half of 2016 - 0.10 - 24 comments, 241 score
Arguments against JSON-driven development - 0.23 - 59 comments, 257 score
New Virus Breaks the Rules of Infection - 0.11 - 29 comments, 265 score
Talk of a Split from Docker - 0.09 - 25 comments, 276 score
Plasma wings could change the way airplanes are designed and flown - 0.09 - 22 comments, 242 score
Twitch could be a $20B company within Amazon - 0.10 - 22 comments, 223 score
A Russian Family Was Isolated for 40 Years, Unaware of WWII (2013) - 0.08 - 21 comments, 279 score
The French Number – Connect to a random French person and talk about anything - 0.11 - 28 comments, 262 score
Git Undo - 0.08 - 23 comments, 286 score
Google Cast is now built-in to Chrome - 0.17 - 39 comments, 235 score
Seven Puzzles You Think You Must Not Have Heard Correctly (2006) [pdf] - 0.09 - 27 comments, 297 score
Why bad scientific code beats code following “best practices” (2014) - 0.21 - 60 comments, 280 score
A Message to the Apple Community in Europe - 0.27 - 79 comments, 289 score
There are no particles, there are only fields (2012) - 0.10 - 30 comments, 290 score
HackedThat: Breaking in to a hardened server via the back door - 0.06 - 16 comments, 270 score
Using attrs for everything in Python - 0.09 - 23 comments, 244 score
Mezzano – An operating system written in Common Lisp - 0.05 - 11 comments, 210 score
ITT is no longer allowed to enroll students who rely on federal loans and grants - 0.11 - 23 comments, 203 score
Use It Too Much and Lose It? The Effect of Working Hours on Cognitive Ability [pdf] - 0.06 - 10 comments, 179 score
What Slack might learn from its Open Source alternative - 0.08 - 18 comments, 218 score
An undercover cop who abandoned the war on drugs - 0.05 - 11 comments, 222 score
SRL – Simple Regex Language - 0.18 - 48 comments, 265 score
Ntfy: A utility for sending notifications - 0.04 - 10 comments, 223 score
WhatsApp – Opting out of new terms doesn’t stop Facebook taking information - 0.10 - 19 comments, 189 score
“Baffling” “signal” “from HD 164595” is probably none of the above - 0.05 - 10 comments, 199 score
Bunnie Huang and Edward Snowden’s Malware-Detecting Smartphone Case - 0.06 - 10 comments, 173 score
Warned of a Crash, Startups in Silicon Valley Narrow Their Focus - 0.10 - 22 comments, 226 score
Italy Quake Rescuers Ask Locals to Unlock their Wi-Fi - 0.10 - 17 comments, 172 score
A FreeBSD 10 Desktop How-To - 0.12 - 23 comments, 199 score
Majority of mathematicians hail from 24 scientific ‘families’ - 0.10 - 17 comments, 171 score
Chinese CA WoSign faces revocation after possibly issuing fake certificates - 0.04 - 7 comments, 177 score
Are Index Funds Eating the World? - 0.18 - 30 comments, 171 score
Itsy Bitsy Data Structures – Simplified examples of many common data structures - 0.06 - 13 comments, 221 score
Scientists Watch Thoughts Form in the Brain - 0.10 - 16 comments, 165 score
How a Technical Co-Founder Spends His Time - 0.05 - 12 comments, 234 score
Principles for Programming Languages for Learners - 0.05 - 11 comments, 221 score
Zig: a system language which prioritizes optimality, safety, and readability - 0.12 - 28 comments, 233 score
Uber's Failure in Japan - 0.14 - 24 comments, 170 score
Why China won’t own next-generation manufacturing - 0.17 - 30 comments, 177 score
How I Used and Abused My Tesla – What a Tesla Looks Like After 100,000 Miles - 0.10 - 19 comments, 192 score
Ask HN: What's the best library for making cross-platform UIs? - 0.28 - 61 comments, 220 score
Kerbal Control Panel - 0.05 - 11 comments, 204 score
Why should children program? A review of Seymour Papert's Mindstorms - 0.12 - 20 comments, 169 score
WebDriver Support in Safari 10 - 0.04 - 8 comments, 182 score
Looking ahead for WhatsApp - 0.17 - 36 comments, 209 score
FBI says foreign hackers penetrated state election systems - 0.08 - 15 comments, 177 score
The first autonomous, entirely soft robot - 0.07 - 13 comments, 188 score
Short-selling as a way to profit from security vulnerabilities - 0.07 - 12 comments, 179 score
Why Nearly Every Film Ends by Saying It’s Fiction - 0.08 - 12 comments, 151 score
KickSat: open source spacecraft project - 0.10 - 19 comments, 192 score
Picolisp - 0.07 - 12 comments, 164 score
The Greater Honeyguide, a Bird That Understands Humans - 0.03 - 3 comments, 89 score
The piracy paradox at Udemy (2015) - 0.12 - 20 comments, 172 score
How Nextdoor reduced racist posts - 0.12 - 21 comments, 173 score
Why Tim Berners-Lee is no friend of Facebook - 0.05 - 9 comments, 165 score
Movfuscator – A single-instruction C compiler - 0.09 - 18 comments, 190 score
Show HN: KnightOS – An open-source OS for calculators - 0.06 - 10 comments, 177 score
How many x86 instructions are there? - 0.07 - 11 comments, 163 score
90% of software developers in the US work outside Silicon Valley - 0.13 - 20 comments, 149 score
The NSA Is Hoarding Vulnerabilities - 0.06 - 9 comments, 153 score
Advanced Deanonymization Attacks - 0.05 - 7 comments, 138 score
How to allocate memory - 0.03 - 5 comments, 156 score
Parallel – A command-line CPU load balancer written in Rust - 0.06 - 9 comments, 147 score
A Sneak Peek Comparison of x264, x265, and libvpx - 0.07 - 11 comments, 149 score
Fluid Simulation (with WebGL demo) - 0.08 - 15 comments, 193 score
Text to Image Synthesis Using Thought Vectors - 0.04 - 6 comments, 152 score
A giant pyramid hidden inside a mountain - 0.06 - 11 comments, 173 score
Ask HN: How do you handle DDoS attacks? - 0.14 - 31 comments, 216 score
A Unix Utility to Know About: lsof (2009) - 0.08 - 11 comments, 146 score
Interview with Steve Wozniak - 0.06 - 9 comments, 158 score
Proposal to add optional social media account fields to US Customs arrival forms - 0.13 - 24 comments, 188 score
Why cities keep growing, corporations and people die, and life gets faster - 0.14 - 17 comments, 120 score
An Interesting SETI Candidate in Hercules - 0.06 - 11 comments, 185 score
FreeSense: Indoor Human Identification with WiFi Signals - 0.09 - 14 comments, 160 score
Mars Explorers Wanted Posters - 0.11 - 17 comments, 158 score
Contributing os.scandir() to Python - 0.05 - 9 comments, 194 score
WhatsApp is going to share your phone number with Facebook - 0.18 - 24 comments, 137 score
HTTP Observatory: analyze your website and review available methods to secure it - 0.05 - 6 comments, 127 score
Btree vs. LSM - 0.08 - 10 comments, 127 score
DTrace and Python - 0.03 - 4 comments, 122 score
German economy minister says EU-US trade talks have failed - 0.09 - 10 comments, 112 score
NESPi – Mini NES Classic Raspberry Pi Games Console - 0.06 - 9 comments, 140 score
SpaceX's Dragon cargo ship splashes down in Pacific - 0.04 - 4 comments, 113 score
Keep a Changelog - 0.10 - 13 comments, 136 score
Rudy Van Gelder, Audio Engineer Who Helped Define Sound of Jazz, Has Died - 0.09 - 11 comments, 124 score
How to Crawl the Web Politely with Scrapy - 0.06 - 8 comments, 138 score
Sierra Gets Creative - 0.05 - 7 comments, 136 score
The Traitorous Eight - 0.06 - 7 comments, 117 score
Chinese Chipmaker Unveils 64-Core ARM Processor - 0.09 - 10 comments, 113 score
Recovering Atari ST ASIC Designs - 0.03 - 4 comments, 116 score
Paid $75k to Love a Brand on Instagram – Is It an Ad? - 0.19 - 19 comments, 98 score
How Your Brain Becomes Addicted to Caffeine - 0.14 - 16 comments, 113 score
Dropbox prompts password resets - 0.08 - 10 comments, 133 score
How We Designed Our Interview Process - 0.13 - 19 comments, 144 score
Mathematician Says Big Data Is Causing a ‘Silent Financial Crisis’ - 0.18 - 20 comments, 112 score
Fork: Fast and Friendly Git Client for Mac - 0.23 - 32 comments, 141 score
Certificate Authority Gave Out Certs for GitHub to a GitHub Account Holder - 0.04 - 4 comments, 109 score
The IBM System/360: the first modular, general-purpose computer - 0.07 - 7 comments, 105 score
The same melodic sequence appears in a surprising number of recent pop songs - 0.13 - 15 comments, 117 score
Bash Infinity: A standard library and a boilerplate framework for Bash - 0.10 - 10 comments, 104 score
Farmers Plant Beehive Guard Posts to Repel Elephants - 0.01 - 1 comments, 109 score
Show HN: A Bot to Deploy to AWS, Digital Ocean Etc. - 0.10 - 12 comments, 123 score
A Surveillance Master Dissects a Murder from the Sky [video] - 0.14 - 18 comments, 128 score
Why the High Cost of Big-City Living Is Bad for Everyone - 0.13 - 12 comments, 94 score
It’s time EU laws caught up with technology - 0.17 - 19 comments, 109 score
Micro v1.0 – a terminal-based text editor written in Go - 0.06 - 9 comments, 147 score
CloudFlare, SSL and unhealthy security absolutism - 0.16 - 20 comments, 127 score
Decoupled Neural Interfaces Using Synthetic Gradients - 0.05 - 6 comments, 119 score
A Simple Makefile for Medium-Sized C/C++ Projects - 0.17 - 21 comments, 122 score
Show HN: In-view.js – Get notified when DOM elements enter or exit the viewport - 0.11 - 13 comments, 114 score
Colombia’s Milestone in World Peace - 0.12 - 13 comments, 108 score
Run Chrome apps in Electron - 0.08 - 8 comments, 104 score
Multi-byte NOP opcode made official - 0.11 - 12 comments, 107 score
Principles of Calm Technology - 0.14 - 14 comments, 101 score
Z3 SMT solver interactive tutorial - 0.04 - 4 comments, 111 score
G.E., the 124-Year-Old Software Start-Up - 0.17 - 19 comments, 114 score
Teaching Your Computer To Play Super Mario Bros - 0.10 - 12 comments, 121 score
The Anthropocene epoch: scientists declare dawn of human-influenced age - 0.04 - 4 comments, 92 score
Pythran: a Python to C++ compiler with a focus on scientific computing - 0.11 - 12 comments, 106 score
A Powerful Russian Weapon: The Spread of False Stories - 0.19 - 20 comments, 108 score
Amazon EC2 Beta (2006) - 0.05 - 6 comments, 119 score
Court Finds Sheriff’s Raid to Find Blogger Who Criticized Him Unconstitutional - 0.08 - 7 comments, 83 score
Can smiling make you happier? - 0.17 - 17 comments, 100 score
Browser Bloat (1996) - 0.12 - 14 comments, 118 score
RE:DOM – Tiny DOM library - 0.19 - 21 comments, 112 score
Hardening Compiler Flags for NixOS - 0.05 - 6 comments, 111 score
Programmer, interrupted (2013) - 0.16 - 17 comments, 106 score
Ask HN: Early signs that a company is failing? - 0.26 - 38 comments, 145 score
Flexible Paxos: Quorum intersection revisited - 0.06 - 5 comments, 89 score
Job Descriptions Should Be Better - 0.12 - 13 comments, 106 score
Apple facing record bill for Irish tax - 0.11 - 10 comments, 87 score
Go's first commit - 0.05 - 5 comments, 107 score
Why the NSA Dump Isn't from an Insider - 0.04 - 4 comments, 106 score
KDevelop 5.0.0 release - 0.07 - 8 comments, 117 score
Lightning Strike Kills More Than 300 Reindeer in Norway - 0.12 - 12 comments, 101 score
Maru OS becomes an open source project - 0.04 - 4 comments, 96 score
Vagrant plugin for Xhyve - 0.06 - 5 comments, 88 score
Offer HN: Free logo design for an open source project - 0.25 - 39 comments, 154 score
Mailbox.org – Privacy made in Germany - 0.22 - 19 comments, 86 score
NASA's Juno to Soar Closest to Jupiter This Saturday - 0.03 - 2 comments, 68 score
Ruminations on D: An Interview with Walter Bright - 0.07 - 6 comments, 87 score
Are we really so modern? - 0.14 - 13 comments, 90 score
Play along with NSA: The RAFTER unintentional radio emissions how-to - 0.04 - 4 comments, 93 score
1Password – Standalone licenses vs. new subscription service - 0.19 - 18 comments, 95 score
How Parents Harnessed the Power of Social Media to Challenge EpiPen Prices - 0.17 - 12 comments, 72 score
Indian ISPs Speed Up BitTorrent by ‘Peering’ with a Torrent Site - 0.15 - 14 comments, 96 score
The target=“_blank” vulnerability by example - 0.06 - 7 comments, 125 score
Ask HN: What kind of projects should I build for a front-end portfolio? - 0.22 - 25 comments, 115 score
An alarming number of scientific papers contain Excel errors - 0.20 - 18 comments, 91 score
Learning from Imbalanced Classes - 0.05 - 5 comments, 108 score
How and why I made a zine - 0.11 - 12 comments, 111 score
Teaching AI to race using NNs and genetic algorithms - 0.12 - 12 comments, 104 score
Typelevel Scala - 0.04 - 4 comments, 90 score
Hacked: Investigating an Intrusion on My Server - 0.14 - 14 comments, 97 score
User-friendly language for programming efficient simulations - 0.08 - 7 comments, 88 score
The Fall of a High-End Wine Scammer - 0.08 - 8 comments, 99 score
The Justice System That Lets Executives Escape Their Crimes - 0.09 - 10 comments, 107 score
What It Takes for an Independent Record Store to Survive Now - 0.11 - 8 comments, 73 score
“To a Top Scientist at Woomera Rocket Range, South Australia” (2009) - 0.07 - 7 comments, 95 score
Opera server breach incident - 0.07 - 5 comments, 73 score
Nearly two-thirds of carbon emissions originated in 90 companies - 0.09 - 6 comments, 66 score
Google recruitment mistakes: part 3 - 0.22 - 22 comments, 100 score
“Death of Satoshi Nakamoto” [pdf] - 0.09 - 7 comments, 75 score
Malware that uses USB drives to covertly jump airgaps - 0.06 - 4 comments, 68 score
Maquette – Pure and simple virtual DOM library - 0.14 - 11 comments, 79 score
Basic income doesn't emphasize divisions between poor and working people - 0.16 - 12 comments, 75 score
In Mathematics, Mistakes Aren’t What They Used to Be (2015) - 0.06 - 6 comments, 104 score
Is Microsoft Excel an Adequate Statistics Package? - 0.24 - 19 comments, 78 score
Optical solutions to NP-Complete problems - 0.08 - 8 comments, 97 score
Performance Improvements for FreeBSD Kernel Debugging - 0.02 - 1 comments, 61 score
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment