mirror of
https://codeberg.org/hyperreal/bin
synced 2024-11-01 08:33:06 +01:00
Add myip and delete_yum_repo
This commit is contained in:
parent
c405b43429
commit
eae217dc7c
16
delete_yum_repo
Executable file
16
delete_yum_repo
Executable file
@ -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
|
30
myip
30
myip
@ -1,28 +1,20 @@
|
|||||||
#!/usr/bin/env python3
|
#!/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 json
|
||||||
|
|
||||||
import requests
|
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__":
|
if __name__ == "__main__":
|
||||||
req = requests.get("https://ipinfo.io")
|
KEY_COLOR = "\033[92m"
|
||||||
json_data = json.loads(req.text)
|
END_COLOR = "\033[0m"
|
||||||
|
|
||||||
|
response = requests.get("https://ipinfo.io", timeout=60)
|
||||||
|
json_data = json.loads(response.text)
|
||||||
|
|
||||||
|
print()
|
||||||
for item in json_data:
|
for item in json_data:
|
||||||
print(
|
print(f"- {KEY_COLOR}{item.title():<16}{END_COLOR} {json_data[item]}")
|
||||||
"- {:<20} {}".format(
|
|
||||||
bcolors.colored(item.title(), bcolors.KEY), json_data[item]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user