Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀
求同存异

David Wong mimoo

🦀
求同存异
View GitHub Profile
@mimoo
mimoo / notipping.md
Last active Jul 19, 2021
No Tipping Restaurants in SF
View notipping.md
View old.md

Once, when we're young, we realize that we're all mortals. It's a shock, it's hard to process, suddenly our world is never going to be the same. But we get over it, and through most of our growth and teenage years we completely forget about our ill fate. We live like there's no tomorrow. In our 30s, as our growth comes to an all-time high, we are faced with our mortality once again. The one we had forgotten about all these years. The bad news we pretended didn't exist. Now, we realize that it's not going to be sudden. Sudden would be good, as we would barely have time to notice. Instead, our fall will take time, and as time flows it'll take away more and more of our features. This slow process will be painful, omnipresent, as we grow in our older years. From that point on, each parts that life will remove from us will be felt. The only escape is to live in the present, and practice gratefulness for the time that we still have and for what's left of the body and mind that life hasn't taken away, yet. Perhaps f

@mimoo
mimoo / advice.md
Last active Jun 25, 2021
Writing a book with asciidoc
View advice.md

I wrote a book using asciidoc, so here are some advice.

  • Setup scripts to automate your tasks as much as possible.
  • Make sure you understand and follow your publisher's requirements as soon as possible.
  • Before copy editing, add line breaks between every sentences, it'll make the git diff much easier to parse once you get there. Also use https://github.com/banga/git-split-diffs
  • Use flamegraphs to make sure that sections are not too long, not too short https://gist.github.com/mimoo/bae1065d92efe9e18b75bb4a86834f6a
  • Always write section titles like someone is reading them to see if they sound interesting: https://gist.github.com/mimoo/60f35cf79593171d114247403671307e
  • Always, always, outline your chapter before starting to write it. Every section should teach a specific and meaningful aspect of your chapter
  • Have real deadlines to avoid spending too much of your time on a specific chapter
@mimoo
mimoo / ocamlformat.md
Last active Jun 8, 2021
how to use ocamlformat?
View ocamlformat.md

OCaml has a tool to format, OCamlformat, that is too configurable and hard to use.

First, it won't work if you don't have an empty file called .ocamlformat at the root of your project.

Here's the man page but it's honestly too long and has no examples. Avoid configuring ocamlformat because then nobody will be able to understand your codebase. Use vanilla ocamlformat please.

To format every file in your project, do:

@mimoo
mimoo / Makefile
Last active May 16, 2021
Manning-style graphics with an asciidoc project on a mac
View Makefile
.PHONY: to_pdf to_png to_png2
# 1. make to_pdf num=01
to_pdf:
pdfseparate "chapter$(num)/all.pdf" "chapter$(num)/CH$(num)_F%02d_Wong.pdf"
rm "chapter$(num)/all.pdf"
# 2. make to_pdf num=01
to_png:
./to_png.sh $(num)
@mimoo
mimoo / ecdh.md
Last active Mar 31, 2021
ECDH security considerations
View ecdh.md

RFC 6090: Fundamental Elliptic Curve Cryptography Algorithms:

The security level of an elliptic curve cryptosystem is determined by the cryptanalytic algorithm that is the least expensive for an attacker to implement. There are several algorithms to consider.

prime-order: shank's baby step giant step, pollard rho, pollard kangaroo/lambda,

non-prime order: Pohlig-Hellman

The order m of the elliptic curve is divisible by the order n of the group associated with the generator; that is, for each elliptic curve group, m = n * c for some number c. The number c is called the "cofactor". [...] It is possible and desirable to use a cofactor equal to 1.

@mimoo
mimoo / hawaii_travel.md
Created Mar 17, 2021
You're traveling to some hawaii island from hawaii? And you have kaiser california? And you have to do a covid test?
View hawaii_travel.md
  • just call kaiser whenever (at least 72h before the flight)
  • tell them you have an account with kaiser north california but you need a test in oahu for travelling on date X (they need it to schedule the test at most 72h in advance)
  • they'll tell you OK, this is the address, go there on this date at this hour (worst case: it doesn't seem to be a big deal if you show up in advance or later)
  • show up to a kaiser hospital before your flight and ask them if they have the result (they should be able to give you a paper copy)
  • take a picture of the result, compress the pic, transform to pdf, upload to the same site you used to fly to oahu
@mimoo
mimoo / README.md
Created Mar 8, 2021
Flamegraph of your asciidoc books
View README.md

I wrote a very primitive script to produce a flamegraph out of a number of asciidoc files. See this blog post for some idea of the result.

flamegraph

WARNING: It's heavily taylored to my own setup, so not sure it'll work directly with yours, or you might have some customization to do. (If there's enough interest I could do a more general script / Dockerfile.)

How to use?

@mimoo
mimoo / waikiki.md
Last active Mar 22, 2021
Hawaii Waikiki Good Spots
View waikiki.md

Waikiki <3

Markets

Every wednesday afternoon (4pm-7pm) and every saturday morning (9am-11am) there are two uber cool markets that serve lots of food! During our time in Waikiki we went there almost every single time. Here's what you HAVE to try:

Wednesday Honolulu Farmer's market: