Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / .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
@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 / gist:f3158b76a7970cc73811e1688336d5a1
Created December 20, 2017 03:00 — forked from giannisp/gist:ebaca117ac9e44231421f04e7796d5ca
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
@pilgrim2go
pilgrim2go / cli.md
Created December 6, 2017 05:18 — forked from phrawzty/2serv.py
simple http server to dump request headers
$ curl -s -H "X-Something: yeah" localhost:8000 > /dev/null
$ python serv.py
ERROR:root:User-Agent: curl/7.37.1
Host: localhost:8000
Accept: */*
X-Something: yeah
@pilgrim2go
pilgrim2go / README.md
Created November 22, 2017 09:27 — forked from ifnull/README.md
Using TOR as a proxy for Python on OSX
sudo apt-get install tor
# check tor service running on port 9050 (ss -aln | grep 9050)
# change ip after every 10 sec
edit vi /etc/tor/torrc and add MaxCircuitDirtiness 10
# use tor proxy in python request
install requests==2.10.0 (pip install requests==2.10.0) (currently 2.11 giving error)
@pilgrim2go
pilgrim2go / README.md
Created October 13, 2017 01:28 — forked from sapessi/README.md
Continuous deployment of React websites to Amazon S3

Continuous deployment of React websites to Amazon S3

This sample includes a continuous deployment pipiline for websites built with React. We use AWS CodePipeline, CodeBuild, and SAM to deploy the application. To deploy the application to S3 using SAM we use a custom CloudFormation resource.

Files included

  • buildspec.yml: YAML configuration for CodeBuild, this file should be in the root of your code repository
  • configure.js: Script executed in the build step to generate a config.json file for the application, this is used to include values exported by other CloudFormation stacks (separate services of the same application).
  • index.js: Custom CloudFormation resource that publishes the website to an S3 bucket. As you can see from the buildspec and SAM template, this function is located in a s3-deployment-custom-resource sub-folder of the repo
  • app-sam.yaml: Serverless Application model YAML file. This configures the S3 bucket and the cu