Skip to content

Instantly share code, notes, and snippets.

@anguiao
anguiao / convert.ts
Created August 17, 2021 04:43
Building binary tree from LeetCode's serialized format
type Nullable<T> = T | null
class TreeNode {
val: number
left: Nullable<TreeNode>
right: Nullable<TreeNode>
constructor (val?: number, left?: Nullable<TreeNode>, right?: Nullable<TreeNode>) {
this.val = val || 0
this.left = left || null
this.right = right || null
@anguiao
anguiao / Dockerfile
Last active February 15, 2020 19:27
nginx-brotli-alpine
FROM alpine:3.9
ENV TZ=Asia/Shanghai
ENV NGINX_VERSION 1.15.8
RUN NGINX_GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
&& CONFIG="\
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \