Skip to content

Instantly share code, notes, and snippets.

View xxxbrian's full-sized avatar

Bojin Li xxxbrian

View GitHub Profile
@xxxbrian
xxxbrian / generate.py
Created February 28, 2024 09:59
Generate typescript type definitions from yaml
import yaml
from rich.console import Console
from rich.markdown import Markdown
# Basic TypeScript types
basic_types = {"string", "number", "boolean", "any", "undefined"}
illegal_chars = [" ", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-", "+", "=", "{", "}", "[", "]", "|", "\\", ":", ";", "\"", "'", "<", ">", ",", ".", "?", "/", "`", "~"]
def extract_custom_types(types):
@xxxbrian
xxxbrian / multiarch-rust-build-docker.sh
Last active January 27, 2024 02:06
Cross-Platform Rust Build Script with Docker
# x86_64 Linux
docker run --rm \
--platform=linux/amd64 \
--user "$(id -u)":"$(id -g)" \
-v "$PWD":/usr/src/myapp \
-w /usr/src/myapp \
rust:latest \
cargo build --release --target x86_64-unknown-linux-gnu
# aarch64 Linux

Keybase proof

I hereby claim:

  • I am xxxbrian on github.
  • I am bojin (https://keybase.io/bojin) on keybase.
  • I have a public key whose fingerprint is 0463 8524 2880 BD5F 5B65 2F9D 89F2 EC59 1CB3 402D

To claim this, I am signing this object: