Skip to content

Instantly share code, notes, and snippets.

View davistran86's full-sized avatar

davistran86

View GitHub Profile
@davistran86
davistran86 / run.tpl
Created April 25, 2023 08:11 — forked from ictus4u/run.tpl
`docker inspect` template to regenerate the `docker run` command that created a container
docker run \
--name {{printf "%q" .Name}} \
{{- with .HostConfig}}
{{- if .Privileged}}
--privileged \
{{- end}}
{{- if .AutoRemove}}
--rm \
{{- end}}
{{- if .Runtime}}
@davistran86
davistran86 / JSONPath in kubectl CLI.md
Created December 29, 2022 04:08 — forked from noseka1/JSONPath in kubectl CLI.md
JSONPath in kubectl CLI examples

Examples

$ kubectl get pods -o json
$ kubectl get pods -o jsonpath='{@}'
$ kubectl get pods -o jsonpath='{.items[0]}'
$ kubectl get pods -o jsonpath='{.items[0].metadata.name}'
$ kubectl get pods -o jsonpath="{.items[*]['metadata.name', 'status.capacity']}"
$ kubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.startTime}{"\n"}{end}'
$ kubectl get pods -o jsonpath='{.items[*].status.podIP}'
@davistran86
davistran86 / Steps_to_Terminal_Enlightenment_on_a_Mac.md
Created October 19, 2022 17:00 — forked from GLMeece/Steps_to_Terminal_Enlightenment_on_a_Mac.md
Steps to Terminal Enlightenment on a Mac (tweaking your terminal for fun and profit)
@davistran86
davistran86 / .env
Created September 28, 2022 10:31 — forked from degitgitagitya/.env
Next JS + Next Auth + Keycloak + AutoRefreshToken
# KEYCLOAK BASE URL
KEYCLOAK_BASE_URL=
# KEYCLOAK CLIENT SECRET
KEYCLOAK_CLIENT_SECRET=
# KEYCLOAK CLIENT ID
KEYCLOAK_CLIENT_ID=
# BASE URL FOR NEXT AUTH
@davistran86
davistran86 / how-to-k3s-ha.md
Created November 22, 2021 07:42 — forked from thebsdbox/how-to-k3s-ha.md
HA K3S with kube-vip

The Architecture

Below is a sample architecture, no workers for this example :-)

  • VIP 192.168.0.40
  • K8S01 192.168.0.41
  • K8S02 192.168.0.42
  • DB01 192.168.0.43

Create our DB on DB01

@davistran86
davistran86 / gitlab-microk8s.md
Created October 12, 2021 15:09 — forked from hardyscc/gitlab-microk8s.md
Gitlab MicroK8s CI/CD Integration

Gitlab MicroK8s CI/CD Integration

Install microk8s

sudo snap install microk8s --classic
sudo microk8s status --wait-ready

Install plugins

@davistran86
davistran86 / README.org
Created November 17, 2020 08:49 — forked from jcouyang/README.org
Promise All with Limit of Concurrent N

The Promise All Problem

in case of processing a very large array e.g. Promise.all(A_VERY_LARGE_ARRAY_OF_XHR_PROMISE)

which would probably blow you browser memory by trying to send all requests at the same time

solution is limit the concurrent of requests, and wrap promise in thunk

Promise.allConcurrent(2)([()=>fetch('BLAH1'), ()=>fetch('BLAH2'),...()=>fetch('BLAHN')])

@davistran86
davistran86 / reactjs-learning-path-2020.md
Created June 28, 2020 16:49 — forked from paulnguyen-mn/reactjs-learning-path-2020.md
Lộ trình học ReactJS cơ bản cho người mới bắt đầu 2020 🚀

Lộ trình học ReactJS cơ bản cho người mới bắt đầu 2020 🎉

  • Đôi tượng: mới bắt đầu học ReactJS mà không biết học những gì.
  • Yêu cầu kiến thức:

Download Udemy course videos using youtube-dl

$ youtube-dl --list-extractors | grep udemy

Steps

  1. Get link to the course to download. e.g. https://www.udemy.com/course-name/
  2. Login into udemy website, save the cookie from Firefox (cookies.txt)[1] export extension. Save it to file cookies.txt

$ youtube-dl https://www.udemy.com/course-name/ --cookies ./cookies.txt > $ youtube-dl -u username -p password -o './videos/%(playlist)s/%(chapter_number)s - %(chapter)s/%(title)s.%(ext)s' https://www.udemy.com/course-name --cookies ./cookies.txt --verbose