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 / auth.json
Created May 5, 2020 04:43 — forked from miguelmota/auth.json
AWS Cognito Identity authenticate using cURL
{
"AuthParameters" : {
"USERNAME" : "alice@example.com",
"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

@pilgrim2go
pilgrim2go / graphUndirected.ipynb
Created April 8, 2019 09:49 — forked from anirudhjayaraman/graphUndirected.ipynb
Python Implementation of Undirected Graphs (Adjacency List and Adjacency Matrix)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pilgrim2go
pilgrim2go / postgresql.py
Created March 6, 2019 08:36 — forked from robertsosinski/postgresql.py
DataDog script for collecting PostgreSQL stats
# Create the datadog user with select only permissions:
# CREATE USER datadog WITH PASSWORD '<complex_password>';
#
# Grant select permissions on a table or view that you want to monitor:
# GRANT SELECT ON <schema>.<table> TO datadog;
#
# Grant permissions for a specific column on a table or view that you want to monitor:
# GRANT SELECT (id, name) ON <schema>.<table> TO datadog;
#
# Let non-superusers look at pg_stat_activity in a read-only fashon.
@pilgrim2go
pilgrim2go / buildspec.yml
Created October 16, 2018 04:43 — forked from QuinnyPig/buildspec.yml
The buildspec.yml that deploys Last Week in AWS.
version: 0.2
phases:
install:
commands:
- echo Entered the install phase...
- pip install -r requirements.txt
build:
commands:
- echo Entered the build phase...