Financial Statements

Here is a nice tutorial on financial statements.

Format a USB stick

There are times Disk Utility cannot help you. Then you know it is time to turn to the command line.

sudo diskutil list
sudo diskutil eraseDisk FAT32 NEW_DISK_NAME /dev/disk3

Make sure /dev/disk3 is indeed the usb drive, go through the drive list from the result of the first command to make sure.

FAT32 is the file system you want to use on the usb drive. And NEW_DISK_NAME is the usb stick volume name. If you pick say myDrive, and you get the error myDrive does not appear to be a valid volume name for its file system, simply use uppercase characters, e.g. MYDRIVE, that will help you move forward. You can rename it later after formatting it.

I converted my unreadable USB drive from

/dev/disk3 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *7.8 GB     disk3
   1:        Apple_partition_map                         4.1 KB     disk3s1
   2:                  Apple_HFS                         2.4 MB     disk3s2


/dev/disk3 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *7.8 GB     disk3
   1:                        EFI EFI                     209.7 MB   disk3s1
   2:       Microsoft Basic Data NEW_DISK                7.6 GB     disk3s2


How to Erase a Disk from Command Line in Mac OS X


Nice tutorials

Total Compensation Calculator

This calculator is so handy!

COVID-19 Vaccine Tracker

Here is a website to track the vaccine progress.

Create diagrams with code

Graphviz is powerful! It can visualize dependency with input from code, that means we can programmatically generate visual output.

digraph MyGraph {
  a -> b
  b -> c
  a -> d
  a -> c



Monty Hall Problem

Interesting brain teaser.

Suppose you’re on a game show, and you’re given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what’s behind the doors, opens another door, say No. 3, which has a goat. He then says to you, “Do you want to pick door No. 2?” Is it to your advantage to switch your choice?



Docker Compose vs Docker Stack

They are very similar, but if you are upgrading from docker compose to docker stack, you may need to modify your existing docker compose yaml file. From what I noticed, here are the obvious pain points

  • No build. If you have build and args, you will need to do that outside of the yaml file. Docker stack expects to see image.
  • No container_name. If you have other services (e.g. nginx) that depend on container_name, you will need to use some workarounds.

Since there are too many sample docker compose yaml files out there, chances are that you will need to modify them if you want to stick with docker stack. I spent too much time playing with nginx, caddy, and traefik, all had some unexpected weird issues with docker stack. The moment I switched back to docker compose, all issues are gone. I will stick with docker compose for now.


Rule of 72

This is interesting.

Say, if I have $100, and the saving account rate is 2%. Assuming compound interest, how long does it take to double the money?

An easy way to estimate that is to simply calculate: 72 / 2, which is 36. So it will take 36 years to double my money.

Really? Let’s see… 100 * (1+0.02)^(36) = 100 * 2.0398… = 203.98 !!! WTF !!!

How about SPY? Based on trailing 10-year data, the fund generated average annual returns of 11.04%. So how long does SPY take to double my money? 72 / 11 = 6.54.

OK, just 6 and a half year. That’s all it takes. =)

Now you know how to do these kinds of estimates.

The math behind this shortcut is actually quite simple:

Covid-19 tests

Apparently there are 3 types of Covid 19 tests.

1. Nucleic acid amplification tests (molecular tests)
  – also known as genetic, RNA or PCR tests.
2. Antibody tests – also known as serology tests.
3. Antigen test

Diagnostic or PCR test. This is the one with the long stick getting mucus from your nose. Even though it takes a few days for the virus to replicate in the nose, this method is so far the most reliable one.

Antibody test. This is a blood test to look for antibodies to the virus. Since it takes time (at least 4 days) for your body to generate antibodies, and without FDA authorization, the result may not mean much.

Antigen test. This method tries to detect proteins from the virus in nose. It is a quick screening test for just a few minutes, but accuracy is still to be determined.