Skip to content

Instantly share code, notes, and snippets.

View Sam-Martin's full-sized avatar

Sam Martin Sam-Martin

View GitHub Profile
@Sam-Martin
Sam-Martin / get_all_lambda_invocation_stats.py
Created October 3, 2019 10:44
Sort lambda functions by invocations
import sys
import boto3
import datetime
cw = boto3.client('cloudwatch')
list_metrics_paginator = cw.get_paginator('list_metrics')
function_stats = []
@Sam-Martin
Sam-Martin / userdata.sh
Created November 14, 2019 16:44
EC2 Userdata for proxy setup of SSM Agent on Amazon Linux 2
#!/usr/bin/env bash
mkdir -p /etc/systemd/system/amazon-ssm-agent.service.d
echo "[Service]" > /etc/systemd/system/amazon-ssm-agent.service.d/override.conf
echo 'Environment="https_proxy=http://proxy:3128"' >> /etc/systemd/system/amazon-ssm-agent.service.d/override.conf
echo 'Environment="http_proxy=http://proxy:3128"' >> /etc/systemd/system/amazon-ssm-agent.service.d/override.conf
echo 'Environment="no_proxy=169.254.169.254"' >> /etc/systemd/system/amazon-ssm-agent.service.d/override.conf
chmod 777 /etc/systemd/system/amazon-ssm-agent.service.d/override.conf
systemctl stop amazon-ssm-agent
systemctl daemon-reload
systemctl restart amazon-ssm-agent
@Sam-Martin
Sam-Martin / Cmdline example
Created January 26, 2020 16:54
Get Media Language Recursively
find . -iregex ".*.\(mp4\|mkv\)" -exec ~/medialanguage.sh "{}" \; | jq '. | select(.Languages | index("English") | not)'