Skip to content

Instantly share code, notes, and snippets.

@pilgrim2go
pilgrim2go / docker-image-size.sh
Created Jul 3, 2020 — forked from andyrbell/docker-image-size.sh
Sort docker images by size desc
View docker-image-size.sh
#!/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 Jun 11, 2020
setup psycopg2 in osx
View psycopg2.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 — forked from miguelmota/auth.json
AWS Cognito Identity authenticate using cURL
View auth.json
{
"AuthParameters" : {
"USERNAME" : "alice@example.com",
"PASSWORD" : "mysecret"
},
"AuthFlow" : "USER_PASSWORD_AUTH",
"ClientId" : "9..............."
}
View delete_all_awslogs.sh.md

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

View keybase.md

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:

View gist:keybase.md

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:

@pilgrim2go
pilgrim2go / graphUndirected.ipynb
Created Apr 8, 2019 — forked from anirudhjayaraman/graphUndirected.ipynb
Python Implementation of Undirected Graphs (Adjacency List and Adjacency Matrix)
View graphUndirected.ipynb
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 Mar 6, 2019 — forked from robertsosinski/postgresql.py
DataDog script for collecting PostgreSQL stats
View postgresql.py
# 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 Oct 16, 2018 — forked from QuinnyPig/buildspec.yml
The buildspec.yml that deploys Last Week in AWS.
View buildspec.yml
version: 0.2
phases:
install:
commands:
- echo Entered the install phase...
- pip install -r requirements.txt
build:
commands:
- echo Entered the build phase...
@pilgrim2go
pilgrim2go / attach-eni.py
Created Sep 26, 2018 — forked from rcillo/attach-eni.py
This gist contains code that attaches an ENI to a running EC2 instance and configures the network accordingly
View attach-eni.py
# -*- coding: utf-8 -*-\
"""
The MIT License (MIT)
Copyright (c) 2015 Zalando SE
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
You can’t perform that action at this time.