Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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

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 / infinity_ergodox.md
Last active April 12, 2020 11:09
#keyboard #config #ergodox

To configure ergodox infinity

  1. Download kiibohd configurator from here
  2. Change mapping and click download firmware
  3. Press flash button on both of the ergodox, the LCD should turn red to show that its in flash mode
  4. Make sure the left ergodox is connected to to usb and also the bin file reference to the left ergodox
  5. Click flash, the left ergodox LCD should change back to the default IC logo
  6. Switch USB cable to right ergodox and update the bin file to right
  7. Do the same as step 5, should get the same end result
@innyso
innyso / Git_rebase_config.md
Last active April 12, 2020 11:10
#git #config
git config --global pull.rebase true
@innyso
innyso / nvm_prefix.md
Last active April 12, 2020 11:10
#nvm #error

when you see:

nvm is not compatible with the npm config "prefix" option

run this:

$ npm config delete prefix 
@innyso
innyso / windows_service_1053.md
Last active April 12, 2020 11:11
#windows #service #error #1053

When running a windows service and you get the following:

StartService FAILED 1053:

The service did not respond to the start or control request in a timely fashion.

One of the reason might be because you cant just run any exe as a windows service. Your need to create an executable which able to communicarte with the Windows service control manager.

@innyso
innyso / kubectl_login_pod.md
Last active April 12, 2020 11:13
#k8s #cmd #pod

login to pod

kubectl exec <pod_name> -c <container_name> -i -t bash --namespace=<namespace>