Skip to content

Instantly share code, notes, and snippets.

View jheerman's full-sized avatar

John Heerman jheerman

View GitHub Profile
@jheerman
jheerman / gist:15d1c75c40bf57ab5ab3cde6dcae80cd
Created June 25, 2020 04:45
Compress video file using ffmpeg
ffmpeg -i input.mp4 -s 640x480 -c:a copy output.mp4
@jheerman
jheerman / update_log-retention_policy.sh
Last active December 18, 2021 04:44
Update AWS Cloudwatch Retention Policy on Log Groups
#!/bin/bash
# This script takes the number of days to retain AWS Cloudwatch logs as an argument
# and updates all AWS Cloudwatch logs policy to the desired retention length
if [ $# -eq 0 ]
then
echo "Please specify the number of days to retain AWS Cloudwatch Logs"
echo "Usage: update-log-retention-policy 90"
echo "Done"
#!/bin/bash
if [ $# -ne 2 ];
then echo -e "\nUsage: '$0 <path to mp4 clips> <name of finalized video>'\n"
exit 1
fi
cd $1
readlink -f *.MP4 > files.txt
sed -i -e 's/^/file /' files.txt
@jheerman
jheerman / gist:1a15a0a504a35eb99018d750c3f45c40
Last active November 2, 2023 20:30
Get AWS roles where last usage is greater than specified date
aws iam list-roles | jq -r '.Roles[].RoleName' | xargs -I % aws iam get-role --role-name % | jq --arg cutoff '2023-04-01T00:00' '.[] | select(.RoleLastUsed.LastUsedDate | . <= $cutoff ) | {RoleName: .RoleName, LastUsedDate: .RoleLastUsed.LastUsedDate}' | jq -s '.' > roles_last_used_april.json