From eae217dc7c9d66c4088572a403acfaff17388317 Mon Sep 17 00:00:00 2001 From: Jeffrey Serio <23226432+hyperreal64@users.noreply.github.com> Date: Fri, 9 Aug 2024 19:08:50 -0500 Subject: [PATCH] Add myip and delete_yum_repo --- delete_yum_repo | 16 ++++++++++++++++ myip | 30 +++++++++++------------------- 2 files changed, 27 insertions(+), 19 deletions(-) create mode 100755 delete_yum_repo diff --git a/delete_yum_repo b/delete_yum_repo new file mode 100755 index 0000000..59e94f7 --- /dev/null +++ b/delete_yum_repo @@ -0,0 +1,16 @@ +#!/usr/bin/env zsh + +selection=$(find /etc/yum.repos.d -type f -name "*.repo" | gum choose --no-limit) + +format_string_array=( + "# You selected the following repo file(s):\n" +) + +echo "$selection" | while read -r line; do format_string_array+=("- $line\n"); done +echo "${format_string_array[@]}" | gum format +echo "" +if gum confirm "Are you sure you want to delete?"; then + sudo rm -v $(echo "$selection") +else + echo ":raised_eyebrow: Oh, okay then. Carry on." | gum format -t emoji +fi diff --git a/myip b/myip index a647b90..cc3ce3d 100755 --- a/myip +++ b/myip @@ -1,28 +1,20 @@ #!/usr/bin/env python3 -# -# myip - Fetch and display public IP information fro ipinfo.io + +""" +myip - Fetch and display public IP information from ipinfo.io +""" import json import requests - -class bcolors: - KEY = "\033[92m" - ENDC = "\033[0m" - - @staticmethod - def colored(message: str, color: str): - return color + message + bcolors.ENDC - - if __name__ == "__main__": - req = requests.get("https://ipinfo.io") - json_data = json.loads(req.text) + KEY_COLOR = "\033[92m" + END_COLOR = "\033[0m" + response = requests.get("https://ipinfo.io", timeout=60) + json_data = json.loads(response.text) + + print() for item in json_data: - print( - "- {:<20} {}".format( - bcolors.colored(item.title(), bcolors.KEY), json_data[item] - ) - ) + print(f"- {KEY_COLOR}{item.title():<16}{END_COLOR} {json_data[item]}")