Ben Chuanlong Du's Blog

And let it direct your passion with reason.

Hands on the Python Library pexpect

Tips and Traps

  1. The command-line tool of some (e.g., network) applications might be slow to authenticate. If you use pexect to automate such a command-line tool, it is best to wait for sometime after sending password using child.sendline(passwd). If the authentication has ouput on both success and failure, a smart way is to wait for the success or failure message to come out.

IPython Is the Best Shell

IPython is the Best Shell!

  1. Use IPython as much as possible.

    • IPython has virtues of both shell and Python.
    • You should avoid using shell scripts for complicate tasks any way.
  2. If you do want to use a Unix/Linux shell, I'd suggest you stick to Bash unless Linux distributions start …

Install Rust Globally in Linux

There are 3 ways to install a global standalone version of Rust in Linux. The recommended way is to use rustup with customized environment variables.

Using a Package Management Tool

Some Linux distributions provide packages for Rust. Taking Debian/Ubuntu based Linux distributions as an example, you can install a …

Take Screenshot on Linux

ksnip

Ksnip is a Qt-based cross-platform screenshot tool that provides many annotation features for your screenshots. It is one of the best screenshot applications.

Installation Using snap

sudo snap install ksnip

flameshot

Flameshot is a simple cross-platform screenshot software.

Shutter

Shutter is a good screenshot application for Linux (only).