Skip to content

Instantly share code, notes, and snippets.

View patrickpierson's full-sized avatar
:shipit:
Ship it!

Patrick Pierson patrickpierson

:shipit:
Ship it!
View GitHub Profile
{
"basics": {
"name": "Patrick Pierson",
"summary": "Director of IT with over 20 years of experience in infrastructure engineering, cybersecurity, and cloud operations. Proven leader in high-performing agile environments, specializing in AWS, CMMC 2.0 compliance, and automated CI/CD workflows. Military intelligence background provides a unique perspective on systems security and mission-critical reliability. Committed to optimizing technology to drive operational excellence and reduce total cost of ownership.",
"email": "patrick.c.pierson@gmail.com",
"location": {
"city": "Frederick",
"countryCode": "US",
"region": "Maryland",
"postalCode": "21702"
import boto3
import botocore
s3_client = boto3.client('s3')
s3_resource = boto3.resource('s3')
def get_bucket_names():
bucket_names = []
for bucket in s3_client.list_buckets().get('Buckets'):
bucket_names.append(bucket.get('Name'))
import boto3
sqs_client = boto3.client('sqs')
while True:
with open('messages.txt', 'a') as save_file:
messages = sqs_client.receive_message(
QueueUrl='https://sqs.us-east-1.amazonaws.com/1234567890123/example',
MaxNumberOfMessages=10
import geopy.distance
import glob2
import json
from pprint import pprint
all_files = glob2.glob('data/**/*.json')
my_loc = (39.0, -77.0)
_5_miles = 0
import glob2
import json
all_files = glob2.glob('data/**/*.json')
flight_reports = []
altitude_reports = []
speed_reports = []
messages = 0
@patrickpierson
patrickpierson / sqs-migrator.py
Last active May 29, 2018 04:25
Migrate messages from one queue to another.
import boto3
from pprint import pprint
source_queue = 'https://sqs.us-east-1.amazonaws.com/AWSACCOUNTID/source-queue'
dest_queue = 'https://sqs.us-east-1.amazonaws.com/AWSACCOUNTID/dest-queue'
import boto3
client = boto3.client('sqs')
@patrickpierson
patrickpierson / default aws profile script
Created November 8, 2016 15:43
setup .bashrc to allow you to easily change the default aws profile
# Add this to .bashrc
function default-aws() {
export AWS_PROFILE=$1
}
# close terminal and reopen. Run the command default-aws <profile> and it will change the default profile used.
# This can replace the need to run --profile at the end of a aws cli command. Useful when using something like
# https://github.com/DualSpark/cloudformation-environmentbase which doesnt handle multiple profiles very well
#!/bin/bash
SERVICE=service
CLUSTER=ecs-cluster
for i in $(aws ecs list-tasks --cluster $CLUSTER --service-name $(aws ecs list-services --cluster $CLUSTER | jq -r '.serviceArns[]' | grep $SERVICE) | jq -r '.taskArns[]'); do aws ec2 describe-instances --instance-ids $(aws ecs describe-container-instances --cluster $CLUSTER --container-instances $(aws ecs describe-tasks --cluster $CLUSTER --tasks $i | jq -r '.tasks[].containerInstanceArn') | jq -r '.containerInstances[].ec2InstanceId') | jq -r '.Reservations[].Instances[].NetworkInterfaces[].PrivateIpAddress'; done;

Keybase proof

I hereby claim:

  • I am patrickpierson on github.
  • I am patrickpierson (https://keybase.io/patrickpierson) on keybase.
  • I have a public key ASB_i0tkFyaW6zEwSAroSeWcSBDmAcNkfr9ApIZabUkmtAo

To claim this, I am signing this object:

# cqlsh to vpc internal ip
cqlsh $(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)
# remove exited containers
docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs docker rm
# remove images marked with <none>
docker rmi $(docker images | grep "^<none>" | awk "{print $3}")