Skip to content

Instantly share code, notes, and snippets.

View indifferentcats's full-sized avatar

Charlie Todd indifferentcats

View GitHub Profile
@indifferentcats
indifferentcats / get_runtimes.sh
Created September 20, 2023 14:20
Get All AWS Lambda runtimes in CSV format for easy sorting and filtering . Optional argument is a list of profiles to query. Only $LATEST versions are captured. Requires all AWS profiles be active (tough to do for sso), or at least any that are listed on the command line if provided. Needs AWS CLI 2.x and jq.
#!/bin/bash
profiles="$@"
if [ -z "$profiles" ]; then
profiles="$(aws configure list-profiles)"
else
echo "Restricting run to these profiles $profiles"
fi
results_folder=results
mkdir -p $results_folder
regions="us-east-1"
#!/bin/bash
echo "Type the new password slowly. Ensure that there are no mistakes."
read -s -p "Please enter the new password> " p;
echo " $(printf "$p" | wc -c) characters long"
g=3
while [ $g -ne 0 ]; do
read -s -p "Verify by typing slowly> " c
if [ "$c" == "$p" ]; then
echo " MATCH"
break
@indifferentcats
indifferentcats / install_missing_so.sh
Created June 21, 2023 15:26
Linux script to auto-install packages for missing shared objects in binaries, typically ones downloaded from the Internet. This is a blind way to find and fix problems like those from chrome/chromedriver when it exits with code 127.
#!/bin/bash
my_uid=$(id -u)
if [ $my_uid -ne 0 ]; then
echo "WARNING: running as non-root. May not be able to install packages."
fi
HAS_APT=$(command -v apt)
HAS_DNF=$(command -v dnf)
HAS_YUM=$(command -v yum)
missing_packages_file=${MISSING_PACKAGES_FILE:-/tmp/list_of_missing_packages.txt}
@indifferentcats
indifferentcats / gitgrep
Last active June 20, 2023 19:50
Search through all branches and history of a repository. Can be sourced or put in a bin folder and run as a script. All passed parameters go straight to `git grep` but it searches through the last 300 commits unless you use `-y`. See git-grep(1) for valid options.
#!/bin/bash
gitgrep ()
{
ref_max=300;
if [ -z "$1" ]; then
echo "Usage: gitgrep [-y num] <search_options> pattern";
echo " -y num is max number of back refs to reverse-order search.";
return 1;
fi;
if [ "$1" == "-y" ]; then