declare -A weather_emoji weather_emoji[01d]=🌞 weather_emoji[02d]=🌥 weather_emoji[03d]=☁ weather_emoji[04d]=☁ weather_emoji[09d]=🌧 weather_emoji[10d]=🌦 weather_emoji[11d]=⛈ weather_emoji[13d]=❄ weather_emoji[50d]=🌫 weather_emoji[01n]=🌑 weather_emoji[02n]=🌑 weather_emoji[03n]=☁ weather_emoji[04n]=☁☁ weather_emoji[09n]=🌧 weather_emoji[10n]=☔ weather_emoji[11n]=⛈ weather_emoji[13n]=❄ weather_emoji[50n]=🌫 function set_text_color() { tput setaf "$1" } function set_bold_text() { tput bold } function reset_text_format() { tput sgr0 } function die() { set_text_color 1 echo "Script failed: $1, exiting..." reset_text_format exit 1 } function round() { echo $(echo "$1" | awk '{print ($1 > int($1)) ? int($1)+1 : int($1)}') } function check_tools() { tools="$1" for tool in "${tools[@]}"; do if [ ! -x "$(command -v "$tool")" ]; then die "$tool is not installed" fi done } function calculate_timezone() { offset_hours=$(("${1:?}" / 3600)) sign="+" if ((offset_hours < 0)); then sign="-" offset_hours=$((-"$offset_hours")) fi echo "${offset_hours:?}" } function generate_random_string() { length="${1:-10}" echo $(cat /dev/urandom | tr -dc 'a-zA-Z09' | head -c "$length") } function checksumm() { echo $(sha256sum "${1:?}" | awk '{print $1}') } function check_connection() { if ping -c 1 google.com &>/dev/null; then echo 1 else echo 0 fi } function create_db() { sqlite3 "$1" "$2" }