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]}")