Use the Watch Command to Monitor Running Applications
Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
Report the number of PNG images in the directory 000
every 2 seconds.
watch "ls 000/*.png | wc -l"
Hands on the highlight command
https://linux.die.net/man/1/highlight
highlight -O ansi
highlight -O xterm256
pygmentize
alias c='pygmentize -g'
Tips on Xonsh
Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
https://github.com/xonsh/xonsh/wiki/Cheatsheet
Tricks and Traps
-
While
$()
in xonsh works similar to$()
in (all variants of) shell, it cannot be used in the middle of argument of …
Calling Shell from Python
Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
-
subprocess.run
is preferred to the functionos.system
for invoking shell commands. For more discussions, pleaser refer to [Hands on the Python module subprocess]https://www.legendu.net/en/blog …
Preferred Python Version in Shebang
Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
#!/bin/sh
''''which python2 >/dev/null 2>&1 && exec python2 "$0" "$@" # '''
''''which python >/dev/null 2>&1 && exec python "$0" "$@" # '''
''''exec echo "Error: I can't find python anywhere" # '''
Reference
https …