Skip to content

Instantly share code, notes, and snippets.

@spinanicky
spinanicky / killfailedshiny.sh
Created September 22, 2023 08:57
Allows you to rapidly identify and kill hung shinyproxy containers
#!/bin/bash
# NOTE: UPDATE PATH TO LOG FILES ON LINE 10
# Prune all stopped containers
echo "Prune all stopped/hung containers:"
docker container prune
# Search the log file for the last occurrence of the specified message
last_failed_bind=$(grep -Eo "Bind for 0.0.0.0:[0-9]+ failed: port is already allocated|listen tcp4 0.0.0.0:[0-9]+: bind: address already in use" /PATHTOLOGS/shinyproxy.log | tail -n 1)
@spinanicky
spinanicky / ec2-spot-price.sh
Last active May 26, 2021 00:16 — forked from louisaslett/ec2-spot-price.sh
Check Amazon EC2 spot prices for an instance type across all regions
#!/bin/bash
# 0. Ensure AWS CLI tool installed: sudo apt install awscli
# 1. Make shell script executable: chmod u+x ec2-spot-prices.sh
# 2. Run script and provide instance type to check: ./ec2-spot-prices.sh c4.8xlarge
# 3. Script runs and outputs full stops while querying the Amazon API,
# returning three columns: Region+AZ, Instance Type, Current Spot Price in $
allSpot=""
for Reg in eu-west-1 eu-west-2 eu-west-3 eu-central-1 eu-north-1 ca-central-1 us-east-1 us-east-2 us-west-1 us-west-2 sa-east-1 ap-southeast-1 ap-northeast-1 ap-east-1 ap-northeast-2 ap-southeast-2 ap-south-1