Shing Lyu

Disclaimer: This content reflects my personal opinions, not those of any organizations I am or have been affiliated with. Code samples are provided for illustration purposes only, use with caution and test thoroughly before deployment.

Generating a notification sound in command-line

You want to play a notification sound in a Linux shell script, but don’t want to download any sound files (e.g. MP3, WAV, MIDI). Here is a script that generates the sound on-the-fly:

First install SoX, the Swiss Army knife of sound processing programs.

sudo apt-get install sox

Then:

play -n synth 0.3 pluck A3 vol -20dB repeat 2
(continue reading...)


How to import serde's custom derive macors properly?

TL;DR Follow the official documentation

(continue reading...)


Caveats in Terraforming WAF V2 for CloudFront

If you want to add a WAF V2 (aws_wafv2_web_acl) to a CloudFront distribution (aws_cloudfront_distribution) using Terraform, there are a few caveats:

(continue reading...)


Check MongoDB index usage statistics

Run this command to get the usage of each index:

(continue reading...)


RFC2616 is dead, read RFC723X

While looking for the definition of HTTP Status Codes, I realize that RFC2616 is deprecated. You should look for RFC7231 instead.

(continue reading...)