Skip to content

Instantly share code, notes, and snippets.

View johanforssell's full-sized avatar

Johan Forssell johanforssell

  • NaN
  • Sweden
  • 04:43 (UTC +02:00)
View GitHub Profile
@johanforssell
johanforssell / find_unused_amis.sh
Created April 29, 2024 08:04
Find all of your own AMIs which are not in use by any EC2 instance, nor are a "backup"
#!/usr/bin/env bash
# Find your AMIs which are not in use by any EC2 instance.
# Filter by a keyword; defaults to removing 'backup'.
# Set AWS credentials and region as normal.
# Remove AMIs with this keyword in the name
FILTERED_KEYWORD="backup"
aws ec2 describe-instances --query 'Reservations[*].Instances[*].ImageId' --output text | sort > /tmp/aws_ec2_ami.all
@johanforssell
johanforssell / aws-vpn-starter.scpt
Last active February 7, 2025 14:11
Start Amazon AWS Client VPN and autopress the connect-button
-- Open the AWS Client VPN app and click the first button in the list.
-- Created because the app itself refuses to press the button on "enter" or "space".
--
-- Open this in "Script Editor", save as Application, start the new app and give it permission to "control your computer" under Accessibility in System Settings.
--
-- External dependency: 'cliclick' installed as `/opt/homebrew/bin/cliclick`!
-- brew install cliclick
-- Using this because I COULD NOT GET reliable clicking done with Apple Script >:-/
try