Skip to content

Instantly share code, notes, and snippets.

View Johnsonkdavid's full-sized avatar
🎗️
Focusing

Johnsonkdavid

🎗️
Focusing
View GitHub Profile
@Johnsonkdavid
Johnsonkdavid / ecr_cleanup.py
Created June 9, 2022 12:38
Python code to clean up ECR images which is NOT using any ECS service, NOT comes in the top 10 latest images in the repo AND which is older than 30 days
import json
import boto3
from datetime import datetime, timedelta
from datetime import date
region=['eu-central-1','us-east-1']
current_date = date.today()
def lambda_handler(event, context):
ecs_used_images=[]
ecr_images=[]
@Johnsonkdavid
Johnsonkdavid / pagerduty_user_export.py
Last active July 19, 2024 20:18
Python api code to export Users list from Pagerduty to CSV file
##Tested and verified in python3 env
#!/usr/bin/python3
import requests
import csv
import json
headers = {
"Content-Type": "application/json",
"Accept": "application/vnd.pagerduty+json;version=2",