#!/bin/bash # # Note: this is a shell script to be included in all other scripts. It subsumes common functionality # across shell scripts in most other shell scripts. # Encode (used to encode image to give to Gemini) function _base64_encode_mac_or_linux() { IMAGE="$1" #data=$(base64 -i "$IMAGE" -o -) # Mac #data=$(base64 -w 0 "$IMAGE") # linux if [[ $(uname) == "Darwin" ]]; then base64 -i "$IMAGE" -o - else base64 -w 0 "$IMAGE" fi } # Decode (used in TTS to decode MP3) function _base64_decode_mac_or_linux() { IMAGE="$1" if [[ $(uname) == "Darwin" ]]; then base64 --decode -i "$IMAGE" -o - else base64 "$IMAGE" --decode fi } # assumes you have the output in file 't' function show_errors_and_exit() { echo Woops. Some Errors found. See error in t: _redden /dev/null; then lolcat else cat fi }