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/" |
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
rsync -v -r --update . [email protected]:/storage/av03089/www/public_html | |
// test with dry run | |
rsync -v -r --update . [email protected]:/storage/av03089/www/public_html --dry-run | |
// had to run sudo -- run from the directory you want to transfer over | |
sudo rsync -v -r --update . [email protected]:/storage/av03089/www/public_html |
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
// bash variabes | |
repo=~/Sites/columbia-repo/ | |
dropbox=~/Dropbox\ \(Personal\)/KJG/Personal/Education/Classes/Advanced\ Programming/homework | |
pass=$repo/auth/.pass | |
clic=clic:/home/kjg2150/cs3157 | |
hw=~/Sites/columbia-repo/c/3157/hw | |
-avz = | |
a = archive | |
v = verbose |
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
rsync my_mock.sql -avz hzn:/home/khaliq/repos/backend/docker/data/db -v |