Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀
求同存异

David Wong mimoo

🦀
求同存异
View GitHub Profile
View dune
(library
(name ocaml_bug)
(inline_tests)
(preprocess
(pps ppx_inline_test)))
@mimoo
mimoo / dune
Last active Mar 6, 2022
OCaml bug: you might think that deriving {hash, eq} is enough to use a custom record in a hashtable. Think again!
View dune
(library
(name ocaml_bug)
(inline_tests)
(preprocess
(pps ppx_inline_test ppx_deriving.eq ppx_deriving_hash)))
View the_list.md
  • 12 Monkeys * 
  • 2001 A Space Odyssey ( o ) 
  • American Psycho *
  • Being John Malkovich * 
  • Cypher 
  • Donnie Darko * 
  • Eternal Sunshine Of The Spotless Mind **
  • eXistenZ ** 
  • Fight Club **
  • Frailty
@mimoo
mimoo / forbidden.ipynb
Last active Aug 24, 2021
Forbidden values in recursive scalar multiplications
View forbidden.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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)