Skip to content

Instantly share code, notes, and snippets.

// (async () => {for (let i = 7150; i <= 7200; i++) {
// await new Promise(res => setTimeout(res, 100))
// const MEET = String(i);
const MEET = '7190';
const ws = new WebSocket(`wss://franklin-f56f3.firebaseio.com/.ws?${new URLSearchParams({v:5,ns:'franklin-f56f3'})}`);
let r = 1;
const send = p => ws.send(JSON.stringify({ t: "d", d: { r: r++, a: "q", b: { p: `/${MEET}/${p}`, h: "" } } }));
let msg = '';
ws.onmessage = async ({ data }) => {
msg += data;
Object.entries(bindings.reduce((acc, o) => {
const qid = o.item.value.split('/').at(-1);
acc[qid] ??= [];
acc[qid].push({
qid,
namedAs: o.subject_named_as.value,
id: o.id.value,
});
return acc;
}, {})).map(([qid, arr]) => `${qid}:\n` + arr.map(o => `- https://worldathletics.org/athletes/_/${o.id} (${o.namedAs})`).join('\n')).join('\n')
const names = ['Amy Begley', 'Chris Lotsbom', 'Erik Kynard', 'Keturah Orji', 'Paul Swangard'];
const evts = [
'Men 60',
'Men 60h',
'Men 400',
'Men 800',
'Men 1500',
'Men 3000',
const evts = [
'Men 60',
'Men 60h',
'Men 400',
'Men 800',
'Men 1500',
'Men 3000',
'Women 60',
'Women 60h',
{
"id": 3003494,
"first_name": "Letesenbet",
"last_name": "Gidey",
"full_name": "Letesenbet Gidey",
"chip_code": "0000152",
"start": "2021-10-24T06:30:03.683000Z",
"race_id": 361,
"wave_id": 76,
"current_position": 24,
@hpr
hpr / calendly.js
Last active October 20, 2021 18:42
// 1. go to https://calendly.com/event_types/user/me
// 2. paste this in javascript console, copy result
(async () => {
const links = [];
$('[aria-label=shareButton').click();
$('[aria-label=oneOffLinkToggle').click();
for (let i = 0; i < 20; i++) {
await new Promise(r => setTimeout(r, 500));
links.push($('[name=shareLinkField]').value);
$('[aria-label=oneOffLinkRefresher]').click();
@hpr
hpr / london.py
Last active October 11, 2021 16:43
import requests
import pprint
import datetime
# https://results.chicagomarathon.com/2021/?content=ajax2&func=getLeaderboard&onpageleaderboard
r = requests.post('https://boston-iframe.r.mikatiming.net/2021/?content=ajax2&func=getLeaderboard&onpageleaderboard', data = {
'options[option_bar][limit]': 100
}).json()
MEN = 0

Background

System Design questions test the candidate's ability to be able to create a system based on a user prompt. A user prompt is either a client telling you what they want or a team making an assumption of what a potential user might want in an idea. What makes this different from an OOP Design question is that this focuses less on the application components themselves and more of the flow of data and how we scale that data based on our understanding of the various trade offs as we modify our system.

Design Fandango II: Scaling

User prompt: I want to be able to book movie theater seats online.

Today, we are going to focus on scaling Fandango.

{
"Q2263": {
"id": "Q2263",
"type": "item",
"modified": "2020-03-25T12:42:54Z",
"labels": {
"en": "Tom Hanks"
},
"descriptions": {
"en": "American actor and producer"