Skip to content

Instantly share code, notes, and snippets.

@hernandanielg
hernandanielg / delete_iam_user.sh
Last active July 14, 2023 09:33
Bash script to delete IAM users using AWS cli tool
#!/bin/bash
#
# @author: Hernan Garcia <hernandanielg@gmail.com>
# https://gist.github.com/hernandanielg/430f3adb8e297f37ef6f0efb45a51bdc
#
# usage: ./delete_iam_user.sh [options] <user>
# options:
# -d|--dry-run dry run mode
#
@ometa
ometa / plex.nginx.conf
Last active May 11, 2024 19:26
NGINX reverse proxy in front of Plex media server v1.3.3.3148
# This example assumes the NGINX proxy is on the same host as the Plex Media Server.
# To configure Plex Media Server to serve requests without requiring authentication,
# ensure that your LAN subnet is correctly added to the advanced server setting called
# "List of IP addresses and networks that are allowed without auth". Example:
# 192.168.0.1/24
upstream plex-upstream {
server 127.0.0.1:32400;
}
@jimfdavies
jimfdavies / helpers.sh
Last active November 16, 2021 02:47
AWS CLI helpers
# Security groups that contain 0.0.0.0/0 rules
aws ec2 describe-security-groups --filters Name=ip-permission.cidr,Values=0.0.0.0/0 --output=text | grep SECURITYGROUPS
# Security groups for ElasticSearch
aws ec2 describe-security-groups --filters Name=ip-permission.from-port,Values=9200 --output=text | grep SECURITYGROUPS
# Search last 10,000/1MB of CloudTrail logs for 'AccessDenied' (removed AWS account number from stream name)
aws logs get-log-events --log-group-name CloudTrail/DefaultLogGroup --log-stream-name 000000000000_CloudTrail_eu-west-1 | grep AccessDenied
# Get number of AWS API calls in time period (assumes a Cloudwatch Logs 'catch-all' filter and metric has been created against CloudTrail logs)