Xinye Tao | Blog - Topic - Resume - Feed

Today I Learned

# Created: 2020-12-30; Modified: 2020-12-30

How to write script that can be safely edited on the run?

Method 1:


Method 2:

  # actual script


Create highlight group in vim
# echo rule.vim
highlight Group ctermbg=green guibg=green
call matchadd("Group", "foo")
# vim text
:so rule.vim


Reclaim disk space (on a shared server)
  1. delete some files

  2. use sudo lsof +L1 to kill process referencing those files

  3. use tune2fs -m <root-reserved-percentage> <device> to grab more space from root

C supports Variable Length Array (VLA)
void initialize(size_t n, size_t m, double A[n][m]);
Forward Declaration in C++

Pros: hide implementations (declare XXImpl), circular dependence, faster compilation

Cons: can’t use alias, potential inheritance is elided, delete an incomplete class is UB