Skip to content

Instantly share code, notes, and snippets.

@pilgrim2go
pilgrim2go / log_min_duration_statement.md
Created July 5, 2023 08:10 — forked from vaughany/log_min_duration_statement.md
Changing Postgres' log_min_duration_statement setting

Changing Postgres' log_min_duration_statement setting on the fly

Check the setting:

SELECT * FROM pg_settings WHERE name = 'log_min_duration_statement';

Change the setting:

SET log_min_duration_statement TO 1000; >

@pilgrim2go
pilgrim2go / kubectl-delete_all
Created August 17, 2021 04:00 — forked from superbrothers/kubectl-delete_all
Kubernetes: Delete all objects in the namespace
kubectl delete "$(kubectl api-resources --namespaced=true --verbs=delete -o name | tr "\n" "," | sed -e 's/,$//')" --all
@pilgrim2go
pilgrim2go / 01_extract_crt.rb
Created April 15, 2021 08:06 — forked from miry/01_extract_crt.rb
Extract certificate from the kubernetes config.
require 'optparse'
require 'yaml'
require 'base64'
options = {
config_path: File.join(ENV['HOME'], '.kube', 'config'),
write_dir: File.join(ENV['HOME'], '.kube')
}
OptionParser.new do |opts|
@pilgrim2go
pilgrim2go / install-docker.md
Created November 13, 2020 02:59 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@pilgrim2go
pilgrim2go / docker-image-size.sh
Created July 3, 2020 00:50 — forked from andyrbell/docker-image-size.sh
Sort docker images by size desc
#!/bin/sh
docker images --format '{{.Size}}\t{{.Repository}}\t{{.Tag}}\t{{.ID}}' | sed 's/ //' | sort -h -r | column -t
@pilgrim2go
pilgrim2go / psycopg2.osx
Last active June 11, 2020 10:50
setup psycopg2 in osx
brew reinstall postgresql
/usr/local/bin/pg_config | grep bin
export PATH=$PATH:/usr/local/Cellar/postgresql/12.3_4/bin/
env LDFLAGS='-L/usr/local/lib -L/usr/local/opt/openssl/lib
-L/usr/local/opt/readline/lib' pip install psycopg2
### references
https://stackoverflow.com/questions/9678408/cant-install-psycopg2-with-pip-in-virtualenv-on-mac-os-x-10-7/30428829
https://stackoverflow.com/questions/33866695/install-psycopg2-on-mac-osx-10-9-5
@pilgrim2go
pilgrim2go / auth.json
Created May 5, 2020 04:43 — forked from miguelmota/auth.json
AWS Cognito Identity authenticate using cURL
{
"AuthParameters" : {
"USERNAME" : "[email protected]",
"PASSWORD" : "mysecret"
},
"AuthFlow" : "USER_PASSWORD_AUTH",
"ClientId" : "9..............."
}
@pilgrim2go
pilgrim2go / delete_all_awslogs.sh.md
Created April 29, 2020 08:35 — forked from pahud/delete_all_awslogs.sh.md
delete all aws log groups

specify the region

export AWS_DEFAULT_REGION=ap-northeast-1
aws logs describe-log-groups --query 'logGroups[*].logGroupName' --output table | \
awk '{print $2}' | grep -v ^$ | while read x; do  echo "deleting $x" ; aws logs delete-log-group --log-group-name $x; done

only delete loggroup name starting with /aws/lambda

Keybase proof

I hereby claim:

  • I am pilgrim2go on github.
  • I am da140110 (https://keybase.io/da140110) on keybase.
  • I have a public key ASCe3oEzRfP-rtLHQs2gWjgsJmoHq9hQTSO5ShQ5IGSekwo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am pilgrim2go on github.
  • I am da140110 (https://keybase.io/da140110) on keybase.
  • I have a public key ASCe3oEzRfP-rtLHQs2gWjgsJmoHq9hQTSO5ShQ5IGSekwo

To claim this, I am signing this object: