Skip to content

Instantly share code, notes, and snippets.

Insert the result of a command to the current file:

# insert result of ls to current file
:r !ls

where

:r --> :r file Read contents of a file to the workspace

@innyso
innyso / paste_command.md
Last active April 18, 2020 02:20
#linux #cmd #paste

Learnt something new this week

I have two files where I want to concat the two column together to create a readme table

$ cat fruit
apple
pineapple
orange
lemon
@innyso
innyso / pipenv_jupyter_notebook.md
Last active April 12, 2020 11:07
#pipenv #python #jupyter

Run Jupyter notebook using pipenv

pipenv shell
pipenv install jupyter
pipenv run jupyter notebook
@innyso
innyso / request_limit_k8.md
Last active April 11, 2020 12:48
#k8s #resource #requet #limit

Request and limit in kubernetes

Request

  • used when scheduling pods to nodes where schduler will ensure the sum of all requests pods on a node does not exceed the capacity of the node
  • request set the minimum resources that are require for the pod i.e. guaranteed to be present on the node

Limit

  • limit set maximum resources that the pod would like to have. This can be higher than its requests. This is best-effort basis

Over subscribe resources

@innyso
innyso / add_commandline_arg_docker_run.md
Last active April 11, 2020 12:46
#docker #cmd #overwrite #entrypoint

A few rules applied when using Entrypoint and CMD

  • must specify at least 1 of them
  • Use CMD to define default executable but its easily overwritable by docker run imagename overwrite-cmd-here
  • Use ENTRYPOINT when you want the user to use the executable defined. Although its still possible to overwrite entrypoint by passing in --entrypoint its a bit harder than CMD
  • To have the ability to combine CMD and ENTRYPOINT, make sure you use the exec format instead of the shell format

To allow user pass in commandline argument during docker run

Dockerfile

@innyso
innyso / remove_all_fg_jobs.md
Last active April 18, 2020 02:19
#linux #cmd #fg #jobs
jobs -p | grep -o -E '\s\d+\s' | xargs kill
git checkout SHA <path/to/file>
@innyso
innyso / linux_find_os_version.md
Last active April 12, 2020 11:06
#linux #cmd #os_version
cat /etc/os-release
lsb_release -a
hostnamectl
@innyso
innyso / vim_paste_in_insert_mode.md
Last active May 9, 2020 11:50
#vim #paste #insertmode

vim offer

  • + or * to access system clipboard
  • " for the unnamed registry which is the last thing y or d

CTRL+r Insert the contents of a register in insert mode.

Hence we can do the following to

@innyso
innyso / vim_registry.md
Last active April 11, 2020 12:42
#vim #register

vim has something called registers which is like spaces that allow us to store text information and allow us to access it using its identifier

default registers

  • + and * system clipboard
  • " unnamed register where everything last yank/delete will be there

numbered registers

  • vim automatic populate "0 to "9 where "0 is the latest yank/delete and the rest are the last 9 yank/delete

read only registry