How to show the tracking relationship between local and remote branches?
git branch -vv
How to change remote tracking branch?
git branch --set-upstream-to origin/somebranch
How to commit without commit message?
git commit --allow-empty-message -m ''
Disply file in binary format
:%!xxd
How to set indent per file?
vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
How to get the type of the current file?
:set ft?
How to scrol screen relative to cursor?
zt
zz
zb
How to flatten a list of lists?
itertools.chain():
itertools.chain(list1, list2, list3)
itertools.chain.from_iterable():
iterables = [list1, list2, list3]
itertools.chain.from_iterable(iterables)
_X
: not imported by a from module import *
statement
__X__
: system-defined names that have special meaning to the interpreter
__X
: localized (“mangled”) to enclosing classes
_
: retaining the result of the last expression when working interactively
How to print the type of a variable?
ptype aVariable
How to write both stdout
and stderr
to files using tee
?
command > >(tee stdout.log) 2> >(tee stderr.log >&2)
based on process substitution and named pipe .
<(cmd)
expression tells the command interpreter to run cmd
and make its output appear as a file.
>(cmd)
captures output that would normally go to a file, and redirects it to the input of cmd
.
> >(...)
redirects stdout
of command
to the FIFO that the first tee
is listening on.
2> >(... >&2)
redirects stderr
of command
to the FIFO that the second tee
is listening on, and redirects the second tee
's stdout
to command
's stderr
.
How to change two windows into two panes of one window?
join-pane -s 2 -t 1 # move the second window as a pane to the 1st window