Skip to content

Instantly share code, notes, and snippets.

View mimoo's full-sized avatar
🦀
求同存异

David Wong mimoo

🦀
求同存异
View GitHub Profile
@mimoo
mimoo / finance.md
Last active February 15, 2021 05:36
What happens when you insert/swipe your bank card in a point of sale?

Developers have this infamous interview question "what happens when you type google.com into your browser's address box and press enter?"

Let's answer a set of similar questions, but in the money space :$

what happens when you insert or swipe your bank card in a point of sale?

  1. The point of sale (PoS) prompts for your PIN, or read information in your magnetic stripe or via RFID (touchless payment)
  2. It then needs to ask for an authorization to your bank (issuing bank, as they "issued" the credit or debit card).
  3. The PoS uses the internet to talk to its acquiring bank (the one that acquired the business, asking them if they wanted to support bank cards and providing the PoS).
  4. The acquiring bank talks to the VISA/Mastercard network.
@mimoo
mimoo / auto.md
Last active December 14, 2020 20:52
Auto Insurance for no travelers in the US

Auto Insurance for no travelers in the US

Context:

  • I'm airbnb hopping, changing address every month, and have no permanent address anymore.
  • My current car insurance (Metromile) noticed this and dropped me (they require you to park your car at least 10 months a year in the same zip code).
  • I can't find an auto insurance because I don't have a permanent address, they don't want me.
  • Using a friend's address or a PO box seems to be fraud insurance, which can lead the insurer to deny me if I get into an accident and need them to pay for something.
  • I'm in California
@mimoo
mimoo / top.md
Last active December 11, 2020 19:54
top 100 movies

Sci-Fi:

  • The Matrix
  • Minority Report
  • Oblivion
  • Interstellar
  • Gravity
  • The Platform
  • Inception
  • Interstellar
@mimoo
mimoo / get_sections.py
Created December 5, 2020 19:59
script to print out sections of `.adoc` files, assuming they all start with `1_something.adoc`, `2_something_else.adoc`, etc.
import glob
import re
import os
def count_equal(line):
res = 0
for i in range(10):
if line[i] == "=":
res += 1
else:
@mimoo
mimoo / timeline.md
Last active November 24, 2020 22:28
quantum timeline

picked interesting elements from https://en.wikipedia.org/wiki/Timeline_of_quantum_computing_and_communication

  • 1980 - Paul Benioff describes the first quantum mechanical model of a computer. In this work, Benioff showed that a computer could operate under the laws of quantum mechanics by describing a Schrödinger equation description of Turing machines, laying a foundation for further work in quantum computing. The paper [5] was submitted in June 1979 and published in April 1980.
  • 1980 - At the First Conference on the Physics of Computation, held at MIT in May, Paul Benioff and Richard Feynman give talks on quantum computing. Benioff's built on his earlier 1980 work showing that a computer can operate under the laws of quantum mechanics. The talk was titled “Quantum mechanical Hamiltonian models of discrete processes that erase their own histories: application to Turing machines”.[8] In Feynman's talk, he observed that it appeared to be impossible to efficiently simulate an evolution of a quantum system on
@mimoo
mimoo / quantum.md
Last active September 10, 2020 18:16
quantum computers opinions

physicists

2018-11-15 - Mikhail Dyakonov - The Case Against Quantum Computing

Could we ever learn to control the more than 10300 continuously variable parameters defining the quantum state of such a system? My answer is simple. No, never.

2015 - Bela Bauer of StationQ Research said in a joint statement with five other researchers

Recent improvements in control of quantum systems make it seem feasible to finally build a quantum computer within a decade.”

@mimoo
mimoo / zkp.md
Last active June 17, 2022 00:18
Zero-Knowledge Proofs FAQ

What's a ZK-SNARK?

A Zero-Knowledge Succinct Non-interactive adaptive ARgument of Knowledge is a term coined by Nir Bitansky† Ran Canetti‡ Alessandro Chiesa§ Eran Tromer in 2011 (From extractable collision resistance to succinct non-interactive arguments of knowledge, and back again).

What are succint proofs?

the ZKProof reference documents different types of succintness:

  • Fully succinct: Proof length independent of statement size. O(1) crypto elements (fully)
  • Polylog succinct: Polylogarithmic number of crypto elements
@mimoo
mimoo / san_francisco.md
Last active August 9, 2020 23:34
Moving Out From SF

Moving Out From San Francisco

San Francisco is not a great city

San Francisco is one of the most horrifying showcases of the US homelessness crisis; the rents are absurdly high; the weather is not great, I pretty much never have the opportunity to wear my shorts and flip flops, I always need a sweater, and if I want to stay out later in the night then I need a jacket; It is not very dense, meaning that you can't really walk around and see shops and restaurants and bars, unless you are fine with limiting yourself to a single street of a neighborhood. In conclusion, SF is really not that great of a city, for someone who likes to live in a city.

Cute Cryptography Stories

Lamport says:

I have long felt that, because it was posed as a cute problem about philosophers seated around a table, Dijkstra's dining philosopher's problem received much more attention than it deserves. (For example, it has probably received more attention in the theory community than the readers/writers problem, which illustrates the same principles and has much more practical importance.) I believed that the problem introduced in [41] was very important and deserved the attention of computer scientists. The popularity of the dining philosophers problem taught me that the best way to attract attention to a problem is to present it in terms of a story.

This page attempts to list these stories.

  • Alice and Bob > For our scenarios we suppose that A and B (also known as Alice and Bob) are two users of a public-key cryptosystem.
  • process_local_timeout(round: Round)
    • if round_state.round does not match round, return
    • (if the timer is an interval timer, we do not need this step)
    • if round_state.vote_sent is empty, this is the first timeout this round (we haven't already voted for a timeout):
      • create a NIL block by calling nil_block = proposal_generator.generate_nil_block(round)
      • execute and store the block by calling executed_block = block_store.execute_and_insert_block(nil_block)
      • obtain a signed vote by calling safety_rules.vote(executed_block)
      • store the vote in round_state.vote_sent
    • if round_state.vote has an empty timeout_signature:
      • create a timeout payload with the current epoch and round: