Skip to content

Instantly share code, notes, and snippets.

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 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...
@pilgrim2go
pilgrim2go / s3bucketsize.py
Created March 15, 2017 02:32 — forked from robinkraft/s3bucketsize.py
Simple python script to calculate size of S3 buckets
import boto
s3 = boto.connect_s3(aws_id, aws_secret_key)
# based on http://www.quora.com/Amazon-S3/What-is-the-fastest-way-to-measure-the-total-size-of-an-S3-bucket
def get_bucket_size(bucket_name):
bucket = s3.lookup(bucket_name)
total_bytes = 0
n = 0
for key in bucket:
@pilgrim2go
pilgrim2go / security-group-cleanup.py
Created August 3, 2018 02:00 — forked from sa-jbrooks/security-group-cleanup.py
Security Group Cleanup using boto3
#!/usr/bin/env python
import boto3
import argparse
def lookup_by_id(sgid):
sg = ec2.get_all_security_groups(group_ids=sgid)
return sg[0].name
@pilgrim2go
pilgrim2go / aws-athena-auto-partition-lambda.py
Created September 20, 2018 08:48 — forked from SQLadmin/aws-athena-auto-partition-lambda.py
AWS Athena create auto partition for CloudTrail logs on Daily Basis
# Lambda function to create partition for Cloudtrail log on daily basis.
# You need to schedule it in AWS Lambda.
'''
-------------------------------------------
AWS Athena Create Partitions Automatically
-------------------------------------------
Version 1.0
Author: SqlAdmin
@pilgrim2go
pilgrim2go / attach-eni.py
Created September 26, 2018 08:08 — forked from rcillo/attach-eni.py
This gist contains code that attaches an ENI to a running EC2 instance and configures the network accordingly
# -*- 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
@pilgrim2go
pilgrim2go / .gitlab-ci.yml
Created September 10, 2018 10:03 — forked from foklepoint/.gitlab-ci.yml
Build and Push images to GCP Container Registry with Gitlab CI
image: docker:latest
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
variables:
DOCKER_DRIVER: overlay
GCP_PROJECT_ID: CHANGE-TO-GCP-PROJECT-ID
IMAGE_NAME: image_id
services:
@pilgrim2go
pilgrim2go / haproxy-parse.sh
Created August 30, 2018 07:44 — forked from fnzv/haproxy-parse.sh
Parsing HAProxy Logs with goaccess
goaccess -f haproxy.log --log-format='%^ %^ %^:%^:%^ %^ %^[%^]: %h:%^ [%d:%t.%^] %^ %^ %^/%^/%^/%^/%L %s %b %^ %^ %^ %^/%^/%^/%^/%^ %^/%^ "%r"' --date-format='%d/%b/%Y' --time-format='%H:%M:%S' -q