\? - help \l - list databases \c <db name> - to connect to a database \d - to list tables Create database CREATE DATABASE <DB_NAME>; CREATE USER <DB_USER> WITH PASSWORD '<PASSWORD>'; GRANT ALL PRIVILEGES ON DATABASE "<DB_NAME>" TO "<DB_USER>"; Backups and Restoring pg_dump -U <DB_USER> -Fp <DB_NAME> > <DB_DUMP_FILENAME> psql -U <DB_USER> -d <DB_NAME> -f <DB_DUMP_FILENAME>
To renew all certs kubectl cert-manager renew --all -n <namespace> Get all resources at once kubectl get <resource_name> | awk '{print $1}' | grep -vi name | xargs -I{} sh -c 'kubectl get <resource_name> {} -o yaml > {}.yaml' kubectl get deployments | awk '{print $1}' | grep -vi name | xargs -I{} sh -c 'kubectl get deployment {} -o yaml > {}.yaml' Apply all resources in a directory kubectl apply -f . kubectl apply -f <directory> --recursive
Postgres shell psql postgres Create User and Database Create user webapp, database webappdb and grant all privileges to user.
To generate random passwords I use: https://passwordsgenerator.net/
CREATE DATABASE webappdb; CREATE USER webapp WITH PASSWORD 'DXw3BzFsNERfPwjg'; GRANT ALL PRIVILEGES ON DATABASE "webappdb" TO "webapp"; Grant read-only permission Grant read-only permission to user webapp_ro to database webappdb
GRANT SELECT ON ALL TABLES IN SCHEMA webappdb TO webapp;
Using Docker host services To use services in host machine, use host.docker.internal as the host. eg: to connect to host mysql
Kill running containers docker kill $(docker ps -q) Removing Dangling images docker rmi $(docker images --filter "dangling=true" -q --no-trunc) Delete all stopped containers docker rm $(docker ps -a -q) Delete an image(s) docker rmi <image_name>:<tag> <image_name>:<tag> docker rmi <image_id> Delete all Docker resources docker system prune -a
Capturing the list of podcasts I listened over the year.
How to Get rich - Naval Ravikant
Founders Talk (Changelog) - Leading Auth0 to a $6.5 billion acquisition
Founders Talk (Changelog) - The journey to massive scale and ultra-resilience - Cockroach DB
Changelog - Inside 2021’s infrastructure for Changelog.com
Go Time (Changelog) - Event-driven systems
Changelog - Curl is a full-time job (and turns 23)
Go Time (Changelog) - Why writing is important
Think Like a CEO - Season-5 Episode-1: Financial Wealth and Freedom
Think Like a CEO - Season-5 Episode 2: The 8 MythUnderstandings Between You and Financial Wealth
…
To apply a single resource terraform apply -target=<resource_type>.<local_name> eg: terraform apply -target=google_sql_database_instance.instance To get a single resource from the state file terraform state show '<resource_type>.<local_name>' eg: terraform state show 'kubernetes_secret.cloudsqlproxy-SA' To delete a single resource from the state file terraform state rm '<resource_type>.<local_name>' eg: terraform state rm 'kubernetes_secret.cloudsqlproxy-SA'