[Optional] Uninstall Docker Desktop
- Start Docker Desktop
- Remove all docker resources (e.g.,
docker container prune) - Stop Docker Desktop
rm -rf ~/.docker
Install Docker in WSL2
| /** | |
| * LCM ... Least Common Multiple (最小公倍数) | |
| * GCD ... Greatest Common Divisor (最大公約数) | |
| * | |
| * LCM = (A * B) / GCD | |
| */ | |
| function _findGCD(a: number, b: number): number { | |
| if (a === 0) return b; | |
| if (b === 0) return a; |
| // https://deno.com/blog/queues | |
| function listenQueue<T>(fn: (msg: T) => Promise<void>) { | |
| // | |
| } | |
| // lib/kv/queue/_core.ts | |
| const messageTypes = { | |
| foo: "foo", |
| // see https://deno.land/std/datetime/constants.ts?source | |
| const MILLISECOND = 1; | |
| const SECOND = MILLISECOND * 1e3; | |
| const MINUTE = SECOND * 60; | |
| const HOUR = MINUTE * 60; | |
| const DAY = HOUR * 24; | |
| const WEEK = DAY * 7; | |
| type Unit = | |
| | "milliseconds" |
see https://pnpm.io/installation
$ pnpm --versioncorepack will NOT be distributed with Node.js v25>= https://nodejs.org/docs/latest-v24.x/api/corepack.html
| // https://www.typescriptlang.org/play#example/nominal-typing | |
| type ValidatedInputString = string & { __brand: "User Input Post Validation" }; | |
| // https://speakerdeck.com/naoya/typescript-niyoru-graphql-batukuendokai-fa-75b3dab7-90a8-4169-a4dc-d1e7410b9dbd?slide=91 | |
| declare const __newtype: unique symbol; | |
| export type newtype<Constructor, Type> = Type & { |
| // see: https://www.bbss.dev/posts/eventloop/ | |
| /** | |
| * @example | |
| * ```ts | |
| * const fn = makePromise(() => { | |
| * return heavyFunc(); | |
| * }); | |
| * // or you can write: | |
| * // const fn = makePromise(heavyFunc); |
ref: https://stackoverflow.com/a/62885391
Run test with the following command:
node --expose-gc ./node_modules/.bin/jest --runInBand --logHeapUsage
--expose-gc is V8 options (see node --v8-options)--logHeapUsage: https://jestjs.io/docs/cli#--logheapusage| mysql> SELECT * FROM information_schema.SCHEMATA WHERE schema_name = "test"; | |
| +--------------+-------------+----------------------------+------------------------+----------+ | |
| | CATALOG_NAME | SCHEMA_NAME | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME | SQL_PATH | | |
| +--------------+-------------+----------------------------+------------------------+----------+ | |
| | def | test | latin1 | latin1_swedish_ci | NULL | | |
| +--------------+-------------+----------------------------+------------------------+----------+ | |
| 1 row in set (0.00 sec) | |
| -- https://stackoverflow.com/a/6115705 | |
| mysql> ALTER DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; |
| # https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesPathPattern | |
| # maybe settings are like the following: | |
| - OriginSettings: | |
| - OriginDomain: MY-EXAMPLE-BUCKET.s3.ap-northeast-1.amazonaws.com | |
| OriginPath: /static | |
| - OriginDomain: example-load-balancer-1234567890.ap-northeast-1.alb.amazonaws.com | |
| OriginPath: * |