Skip to content

Instantly share code, notes, and snippets.

@lysender
lysender / linux-find-and-exec.md
Last active August 14, 2023 08:25
Linux find and exec

Change permissions of all files in a directory including files inside sub-directories

I wanted to ensure that all files has the 644 permissions but I don't want the directories to have the same permissions.

First, I'll run it with ls -l command to avoid accidental command execution.

find ./ -type f -name "*" -exec ls -l "{}" \;
@lysender
lysender / delete-pods-with-shutdown-status.sh
Created October 7, 2021 01:27
Delete pods with Shutdown status
# Replace get with delete at the end
kubectl get pods -n jx-staging | grep -i shutdown | awk '{print $1}' | xargs -n1 kubectl get pod -n jx-staging
@lysender
lysender / ordering-list.md
Last active August 16, 2021 04:26
Ordering a list in a database

Sauces:

Solution: make index a string (because strings, in essence, have infinite "arbitrary precision"). Or if you use an int, increment index by 100 instead of 1.

The performance problem is this: there is no "in between" values between two sorted items.

@lysender
lysender / jx-get-application-activity.sh
Created March 17, 2021 06:47
View jx application activity real time logs
jx get activity -f <application-name> -w
@lysender
lysender / kubernetes-remove-namespace-stuck-at-terminating.md
Last active December 17, 2020 08:23
Kubernetes remove namespace stuck at terminating
@lysender
lysender / base64-encode-single-line.sh
Last active August 19, 2020 08:25
Base64 encode single line
base64 -w 0 id_rsa > id_rsa_flat
@lysender
lysender / jx-manual-promotion-to-staging.sh
Created August 12, 2020 06:25
Jenkins-X Manually promote a branch
jx promote --app app-name --version 0.0.23 --env staging
@lysender
lysender / kubectl-exec-into-pod.sh
Created August 12, 2020 06:09
Exec into Kubernetes Pod
# Without namespace
kubectl exec -it <pod name> -- sh
# With namespace
kubectl exec -it -n jx-staging <pod name> -- sh
@lysender
lysender / typegoose-multiple-fields-text-index.md
Created August 6, 2020 04:52
Typegoose Multiple Fields Text Index
@index({ field1: 'text', field2: 'text' })
@lysender
lysender / keybase.md
Created July 2, 2020 06:56
keybase.md

Keybase proof

I hereby claim:

  • I am lysender on github.
  • I am lysender (https://keybase.io/lysender) on keybase.
  • I have a public key ASDA0fsB3YTGNxM_rKta9ejgIpBPE4PyPnnMdcD_ERcXNQo

To claim this, I am signing this object: