Ben Chuanlong Du's Blog

It is never too late to learn.

Make Charts in Markdown Using Mermaid

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

https://frehberg.com/2022/12/docs-as-code-mermaid-inline-diagrams/ Docs as Code: Mermaid inline diagrams

Tools for Rust

https://crates.io/crates/aquamarine Aquamarine is a procedural macro extension for rustdoc, that aims to …

Popular General Purpose Language Parsers

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

pest

pest is a general purpose parser written in Rust with a focus on accessibility, correctness, and performance. It uses parsing expression grammars (or PEG) as input, which are similar in …

Bundle Resource Files into a Rust Application

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

  1. The Rust macro include_str includes a UTF-8 encoded file as a string; the Rust macro include_bytes includes a file as a reference to a byte array. Both of those 2 macros load files into the Rust binary at compile time and consume memory at run time. It might not be a good idea to use them for large files!

Dealing With Environment Variables in Python

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

  1. os.environ is a dict-like object containing environment variables as keys and their values as values. You can query the value of an environment variable using os.environ[ENV_VAR_NAME]. And you can set the value of an environemnt variable using os.environ[ENV_VAR_NAME] = val