Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Hai Dam naviat

🏠
Working from home
View GitHub Profile
View Cronjob_ECR_authentication.md

A Kubernetes cronjob to refresh ECR authentication

Create AWS secret

kubectl create secret generic aws-secret --from-literal=AWS_ACCOUNT= --from-literal=AWS_ACCESS_KEY_ID= --from-literal=AWS_SECRET_ACCESS_KEY= --from-literal=AWS_DEFAULT_REGION= --from-literal=AWS_REGION=

Create cronjob

@naviat
naviat / awk.md
Last active May 18, 2020
Snippet shell
View awk.md

AWK COMMAND

  • List of commands you use most often
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
  • Remove duplicate entries in a file without sorting.
@naviat
naviat / kubectl.md
Created May 9, 2020 — forked from so0k/kubectl.md
Playing with kubectl output
View kubectl.md

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@naviat
naviat / kubectl.md
Created May 9, 2020 — forked from so0k/kubectl.md
Playing with kubectl output
View kubectl.md

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@naviat
naviat / kubectl-multi-version-brews.md
Created May 9, 2020 — forked from rdump/kubectl-multi-version-brews.md
kubectl multi-version brews (kubernetes-cli formula)
View kubectl-multi-version-brews.md

kubectl multi-version brews

We need to run multiple versions of kubectl for compatibility with various kubernetes clusters.

It's a bit easier to get and use multiple versions of kubectl using Homebrew than it is using Macports.

With brew, it's simple to:

  • Install a bunch of versions of kubectl (in the kubernetes-cli Formula)
  • Switch between them as needed
View nginx-open-portal.conf
$ docker exec -it open-portal-v1 cat /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
location / {
try_files $uri $uri/ @rewrites;
root /usr/share/nginx/html;
index index.html index.htm;
}
View Anaconda-create-env.md

Open Anaconda Prompt (base):

Update conda:

conda update -n base -c defaults conda

Create new environment with Python 3.8:

conda create -n python38 python=3.8

@naviat
naviat / public-stun-list.txt
Created Apr 9, 2020 — forked from mondain/public-stun-list.txt
Public STUN server list
View public-stun-list.txt
23.21.150.121:3478
iphone-stun.strato-iphone.de:3478
numb.viagenie.ca:3478
s1.taraba.net:3478
s2.taraba.net:3478
stun.12connect.com:3478
stun.12voip.com:3478
stun.1und1.de:3478
stun.2talk.co.nz:3478
stun.2talk.com:3478
View Mastering_your_history.md

Mastering your history

Frequently rebasing from master

If you work on feature branches, like we do, that are based off a parent branch (e.g. the master branch of the main repository), you want to avoid your branch getting out of sync with the latest work in the parent branch.

As time goes by, your forked branch where you’re working can become significantly out of sync with the latest master branch. This may mean that merging your work

View ensureSuccess.sh
#!/bin/sh
# Checks that the given error code is zero. If not, exits the script after printing the given error message.
# @param 1 the return code to check.
# @param 2 the error message to display in case the given error code is non-zero.
# @stdout nothing in case of success, the given error message otherwise.
ensureSuccess() {
if [[ $1 -ne 0 ]]; then
echo
echo "Error: $2"
You can’t perform that action at this time.