This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| aws s3 cp --sse AES256 s3://my-bucket/image/p_2/1647967203002.jpg s3://images-production/p_3/1647967203002.jpg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # check expiration | |
| kubeadm alpha certs check-expiration | |
| kubeadm alpha certs renew all | |
| cp -i /etc/kubernetes/admin.conf $HOME/.kube/config | |
| # https://stackoverflow.com/questions/49885636/kubernetes-expired-certificate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT * FROM pg_stat_activity WHERE state = 'active'; | |
| SELECT pg_cancel_backend(<PID>); | |
| SELECT pg_terminate_backend(<PID>); | |
| -- kill all active except active one | |
| SELECT pg_terminate_backend(pid) | |
| FROM pg_stat_activity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # mac | |
| sed -i '' 's/hello/bonjour' greetings.txt | |
| sed -i '' 's|{{ DB_SHARED_BUFFERS }}|'"$DB_SHARED_BUFFERS"'|g' ./postgres/postgresql.conf | |
| # linux | |
| sed -i 's/hello/bonjour' greetings.txt | |
| sed -i 's|{{ DB_SHARED_BUFFERS }}|'"$DB_SHARED_BUFFERS"'|g' postgres/postgresql.conf | |
| find . -type f -name "*.ts" -print0 | xargs -0 sed -i '' -e 's/[..\/]*shared/@shared/g' && find . -type f -name "*.ts" -print0 | xargs -0 sed -i '' -e "s/@shared'/@shared\/index'/g" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BUCKET_NAME="foo" | |
| DIRECTORY="bar" | |
| aws s3api list-objects-v2 --output text --bucket $BUCKET_NAME --prefix $DIRECTORY --query 'Contents[].[Key]' | pv -l > FILES.keys | |
| tail -n+0 FILES.keys | pv -l | grep -v -e "'" | tr '\n' '\0' | xargs -0 -P4 -n1000 bash -c 'aws s3api delete-objects --bucket $BUCKET_NAME --delete "Objects=[$(printf "{Key=%q}," "$@")],Quiet=true"' _ | |
| # https://serverfault.com/questions/679989/most-efficient-way-to-batch-delete-s3-files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # From pod to host | |
| kubectl cp jigasi-767f64f5bf-zjvfv:/config/log/jitsi0.pcap jigasi.pcap | |
| # From host to pod | |
| kubectl cp dev.dump database-777b9f9c4-p6g4s:/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| docker ps --no-trunc | |
| # https://stackoverflow.com/questions/27380641/see-full-command-of-running-stopped-container-in-docker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CPU_LIMIT=$(echo "$customer_line" | jq -r '.cpu_limits.foo // 0') | |
| MEMORY_LIMIT=$(echo "$customer_line" | jq -r 'if has("memory_limits") then .memory_limits.foo else 0 end') | |
| # https://stackoverflow.com/questions/56555155/get-or-default-function-in-jq/56555442#56555442 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| environment=${1:-develop} | |
| FOO="${VARIABLE:=default}" | |
| https://stackoverflow.com/questions/2013547/assigning-default-values-to-shell-variables-with-a-single-command-in-bash | |
| https://stackoverflow.com/questions/9332802/how-to-write-a-bash-script-that-takes-optional-input-arguments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // syncing from my server to my dropbox some data files | |
| rsync -r khaliqgant:/home/kjg/finances/data "/Users/kgant/Dropbox (Personal)/KJG/Personal/Finances/App Data Backup/" |