Ctrl-A |
(horizontal) or Ctrl-A %
(vertical) to split, arrow key to navigate
- Split screen horizontally:
Shift+F2
orCtrl+A
then|
- Split screen vertically:
Ctrl+F2
orCtrl+A
then%
- Switch focus:
Shift+↑ ↓ ← →
or
import argparse | |
parser = argparse.ArgumentParser(description="script description") | |
parser.add_argument('input_names', nargs="*", help="input name(s)") | |
parser.add_argument('-t', '--target', required=True) | |
parser.add_argument('-of', '--option-flag', action='store_true', default=False, help="description for option flag") | |
parser.add_argument('--number', type=int, default=0, help="description for int num") | |
args = parser.parse_args() |
import subprocess | |
import shlex | |
cmd = 'ls -lhrt python' | |
subprocess.call(shlex.split(cmd)) | |
try: | |
subprocess.check_output(['ls']) | |
except subprocess.CalledProcessError as e: |
ssh-keygen -t rsa -C "[email protected]" -b 4096 |
""" | |
example dockerfile for longprocess: | |
https://github.com/ipan/dockerfiles/tree/master/longprocess | |
""" | |
import docker | |
client = docker.from_env() | |
lp = client.containers.run("longprocess", "/src/run.sh 5", detach=True) |
def rand_string(length): | |
""" Generates a random string of numbers, lower- and uppercase chars. """ | |
rand_str = ''.join(random.choice(string.ascii_lowercase | |
+ string.ascii_uppercase | |
+ string.digits) | |
for i in range(length)) | |
return rand_str | |
print(rand_string(10)) |
:w !sudo tee % |
Ctrl-A |
(horizontal) or Ctrl-A %
(vertical) to split, arrow key to navigate
Shift+F2
orCtrl+A
then |
Ctrl+F2
orCtrl+A
then %
Shift+↑ ↓ ← →
orjq will sort (-S
) the whole file (.
) and compare STDOUT (<()
) with diff
diff <(jq -S . A.json) <(jq -S . B.json)
Both include
flags needs to go before exclude
. The -z, --compress
will compress the files during transfer and the -m, --prune-empty-dirs
will delete empty folders in destination.
rsync -avmz --include="*/" --include="*.sh" --exclude="*" "$from" "$to"