Day 177
Python
Getopt
15.6. getopt — C-style parser for command line options — Python 2.7.16 documentation, especially the part optlist, args = getopt.getopt(args, 'abc:d:')
– the options with a colon following need to have a value. Otherwise GetOptError will be raised.
Pandas Counter
Counter is much faster than count() in cases when you need to count multiple objects – you don’t have to iterate once for each object.
Jupyter notebook tqdm
Use from tqdm import tqdm_notebook as tqdm
instead of usual vanilla tqdm.
Vim
vimdiff
vimdiff file1 file2
opens a nice vim session with two buffers. [c
and ]c
jump back and forward between changes. (See http://vimcasts.org/episodes/comparing-buffers-with-vimdiff/)
Switch splits’ position in vim
<C-w> <C-r>
just rotates all the splits, and <C-w> x
to switch the current window with the next one. (split - Swap the position of two windows - Vi and Vim Stack Exchange)
Vim search history
:history /
(Is there search and replace history in vim? - Vi and Vim Stack Exchange)