Ben Chuanlong Du's Blog

It is never too late to learn.

Environment Variables and Secure Path for sudo

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

sudo -E command_to_run

sudo $(which command_to_run)

sudo env "PATH=$PATH" nvim

The "correct" way is to update the secure path using the commanding sudo visudo.

For more discussions, please refer to …

Rust Error "error: expected item, found 'let'"

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

The error message "error: expected item, found 'let'" is commonly encountered in Rust when you mistakenly place a let statement in an invalid location. A let statement can only be used …

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