about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2024-10-05 10:31:29 -0700
committerFranck Cuny <franck@fcuny.net>2024-10-05 10:31:29 -0700
commit7e1f7a167b52b0fe1e0978b2632610b0201383c0 (patch)
tree6f967bb268125d493d7b53df01b68653e057cb21
parentinstall nixos-rebuild (diff)
downloadworld-7e1f7a167b52b0fe1e0978b2632610b0201383c0.tar.gz
remove a few scripts
-rw-r--r--pyproject.toml2
-rwxr-xr-xsrc/cli/seqstat.py27
-rwxr-xr-xsrc/cli/slocalc.py67
3 files changed, 0 insertions, 96 deletions
diff --git a/pyproject.toml b/pyproject.toml
index 1544d77..a81475a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -72,5 +72,3 @@ int2ip = "cli.ipconverter:int2ip"
 ip2int = "cli.ipconverter:ip2int"
 nomad_allocs = "cli.nomad_allocs:cli"
 pizza = "cli.pizza:main"
-seqstat = "cli.seqstat:cli"
-slocalc = "cli.slocalc:cli"
diff --git a/src/cli/seqstat.py b/src/cli/seqstat.py
deleted file mode 100755
index 196fe56..0000000
--- a/src/cli/seqstat.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python3
-
-import click
-
-ticks = ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"]
-
-
-def histogram(sequence):
-    min_val = min(sequence)
-    max_val = max(sequence)
-
-    scale = (int(max_val - min_val) << 8) / (len(ticks) - 1)
-    if scale < 1:
-        scale = 1
-
-    return [ticks[int((int(i - min_val) << 8) / scale)] for i in sequence]
-
-
-@click.command()
-@click.argument("numbers", nargs=-1, type=float)
-def cli(numbers):
-    h = histogram(numbers)
-    print("".join(h))
-
-
-if __name__ == "__main__":
-    cli()
diff --git a/src/cli/slocalc.py b/src/cli/slocalc.py
deleted file mode 100755
index bc4def8..0000000
--- a/src/cli/slocalc.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/env python3
-"""
-A simple SLO calculator for the command line.
-
-$ slocalc.py 99.99
-daily:     0 days, 0 hours, 0 minutes, 8 seconds
-weekly:    0 days, 0 hours, 1 minutes, 0 seconds
-monthly:   0 days, 0 hours, 4 minutes, 19 seconds
-quarterly: 0 days, 0 hours, 12 minutes, 57 seconds
-yearly:    0 days, 0 hours, 52 minutes, 33 seconds
-"""
-
-import sys
-from typing import Optional
-from datetime import timedelta
-
-seconds_in_hour = 60 * 60
-
-
-def convert_to_float(s: str) -> Optional[float]:
-    try:
-        return float(s)
-    except ValueError:
-        print(f"error: '{s}' cannot be converted to float")
-        return None
-
-
-def seconds_to_human_readable(seconds: int) -> str:
-    delta = timedelta(seconds=seconds)
-    days = delta.days
-    hours, remainder = divmod(delta.seconds, 3600)
-    minutes, seconds = divmod(remainder, 60)
-    return f"{days} days, {hours} hours, {minutes} minutes, {seconds} seconds"
-
-
-def cli():
-    if len(sys.argv) <= 1:
-        print("you need at least one argument", file=sys.stderr)
-        sys.exit(1)
-
-    uptime = convert_to_float(sys.argv[1])
-    if uptime is None:
-        print("failed to read input")
-        sys.exit(1)
-
-    if uptime <= 0:
-        uptime = 0
-    if uptime >= 100:
-        uptime = 100
-
-    allowed_downtime = ((100 * 100) - (uptime * 100)) / (100 * 100)
-
-    daily_seconds = seconds_in_hour * 24 * allowed_downtime
-    week_seconds = daily_seconds * 7
-    month_seconds = daily_seconds * 30
-    quarter_seconds = daily_seconds * 90
-    year_seconds = daily_seconds * 365
-
-    print("daily:     {0}".format(seconds_to_human_readable(daily_seconds)))
-    print("weekly:    {0}".format(seconds_to_human_readable(week_seconds)))
-    print("monthly:   {0}".format(seconds_to_human_readable(month_seconds)))
-    print("quarterly: {0}".format(seconds_to_human_readable(quarter_seconds)))
-    print("yearly:    {0}".format(seconds_to_human_readable(year_seconds)))
-
-
-if __name__ == "__main__":
-    cli()