diff --git a/tools/repo/check.d/00-all-tools-executable.sh b/tools/repo/check.d/00-all-tools-executable.sh index 88b47e0..d6eba76 100755 --- a/tools/repo/check.d/00-all-tools-executable.sh +++ b/tools/repo/check.d/00-all-tools-executable.sh @@ -1,6 +1,6 @@ #!/bin/sh -for s in $(find tools/ -type f -iname "*.sh"); do +for s in $(find tools/ -type f -regex ".*\.\(sh\|py\)"); do if ! [ -x $s ]; then echo "$s is not executable" exit 1 diff --git a/tools/repo/fix-script-permissions.sh b/tools/repo/fix-script-permissions.sh index 21eaa8c..2f44dc7 100755 --- a/tools/repo/fix-script-permissions.sh +++ b/tools/repo/fix-script-permissions.sh @@ -1,6 +1,6 @@ #!/bin/sh -for s in $(find tools/ -type f -iname "*.sh"); do +for s in $(find tools/ -type f -regex ".*\.\(sh\|py\)"); do [ -x $s ] && continue echo "fixing permissions for $s..." chmod +x $s diff --git a/tools/statistics/get-monthly-cost.py b/tools/statistics/get-monthly-cost.py new file mode 100755 index 0000000..be57c22 --- /dev/null +++ b/tools/statistics/get-monthly-cost.py @@ -0,0 +1,22 @@ +#!/bin/python3.11 + +try: + from hcloud import Client +except ModuleNotFoundError: + print("please install hcloud module") + exit(1) + +import os + +client = Client(token=os.environ.get("HCLOUD_TOKEN")) + +price = 0 + +for server in client.servers.get_all(): + for pricing in server.server_type.prices: + if pricing['location'] == server.datacenter.location.name: + price += float(pricing['price_monthly']['gross']) + if server.public_net.primary_ipv4 is not None: + price += .61 # this is the gross amount pulled from the console at Oct 29th 16:57. + +print(f"~{price} EUR")