Ben Chuanlong Du's Blog

And let it direct your passion with reason.

Hands on the Python module subprocess

General Tips

  1. The method subprocess.run is preferred over older high-level APIs (subprocess.call, subprocess.check_call and subprocess.check_output). The method subprocess.Popen (which powers the high-level APIs) can be used if you need advanced controls. When running a shell command using subprocess.run,

    1. Avoid using system shell (i.e., avoid using shell=True) for 2 reasons. First, avoid shell injection attack. Second, there is no need for you to manually escape special characters in the command.

Understand Execuation of SQL Statements

Execuation Order

A SQL statement selects rows and columns from a big (rectangular) table. You put columns that you want to select after SELECT and rows you want to select after FROM. A SQL statement is executed as follows. First, the (INNER|LEFT|RIGHT|FULL) JOIN (ON) is executed if any (see more explanation later). Second, the WHERE

Map Keys in macOS

Update: As of MacOS Sierra 10.12.1, the remapping of Caps Lock to Escape can be done natively in the Keyboard System Preferences pane. Follow the steps below to remap Caps Lock to Escape (without relying on 3rd party software).

  1. Open System Preferences and click on Keyboard
  2. Click on …

Map Keys in Windows

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

If you are a heavy Vim user and you have work on Windows, it is suggested that you Swap the Caps Lock key with the Escape key. The swaped key mapping …