Skip to content

Instantly share code, notes, and snippets.

View johnnybenson's full-sized avatar
👽
let's go

j-hnny johnnybenson

👽
let's go
View GitHub Profile
@johnnybenson
johnnybenson / Dockerfile
Created March 10, 2022 20:39
Docker + Rust + Heroku + Cargo Chef -- Small multistage build that works on Heroku with dependency caching with working SSL
################################################################################
## Rust -- Recipe
################################################################################
FROM rust:latest AS chef
RUN cargo install cargo-chef
WORKDIR /var/app
FROM chef AS planner
@johnnybenson
johnnybenson / clean_up_lambda.sh
Created March 29, 2023 21:17
Clean up old AWS Lambda Functions
function run() {
LAMBDA_FUNCTION=$1;
LAMBDA_VERSIONS_DATA=$(aws lambda list-versions-by-function --function-name $LAMBDA_FUNCTION);
LAMBDA_VERSIONS=$(echo $LAMBDA_VERSIONS_DATA | jq -r '.Versions | map(select(.Version != "$LATEST")) | map(.Version | tonumber)');
LAMBDA_VERSION_LATEST=$(echo $LAMBDA_VERSIONS | jq -r 'sort | .[-1:][0]');
echo "Latest Version: $LAMBDA_VERSION_LATEST";
LAMBDA_VERSIONS_ARR=($(echo $LAMBDA_VERSIONS | jq -r 'join(" ")'));
for version in "${LAMBDA_VERSIONS_ARR[@]}"; do
if (( version < LAMBDA_VERSION_LATEST )); then
echo "Removing old Version: $version";