diff --git a/python/convert-epoch b/python/convert-epoch new file mode 100755 index 0000000..3234e2a --- /dev/null +++ b/python/convert-epoch @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 + +import argparse +import time +import color + +def parse_args(): + argp = argparse.ArgumentParser() + argp.add_argument('epoch_time', help="Epoch time value") + return argp.parse_args() + + +def convert_time(epoch): + local_time = time.strftime("%c", time.localtime(epoch)) + zulu_time = time.strftime("%c", time.gmtime(epoch)) + return (local_time, zulu_time) + + +if __name__ == "__main__": + args = parse_args() + + local_time, zulu_time = convert_time(float(args.epoch_time)) + + print(f"\nEpoch time: {color.red(args.epoch_time)}") + print(f"Local time: {color.yellow(local_time)}") + print(f"Zulu time: {color.yellow(zulu_time)}\n") + diff --git a/fake-logs b/python/fake-logs similarity index 100% rename from fake-logs rename to python/fake-logs diff --git a/python/how-long-since b/python/how-long-since new file mode 100755 index 0000000..157ad71 --- /dev/null +++ b/python/how-long-since @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + +""" +Calculates the number of actual days since everyone +went into hiding (quarantine). +""" + +import argparse +import datetime +import dateutil.parser +import color + + +def parse_args(): + argp = argparse.ArgumentParser() + argp.add_argument('starting_date', help="Provide a starting date as a string") + argp.add_argument('--utc', '-u', action='store_true', help="From UTC perspective") + return argp.parse_args() + + +if __name__ == "__main__": + args = parse_args() + + if args.utc: + right_now = datetime.datetime.utcnow() + else: + right_now = datetime.datetime.now() + + delta = right_now - dateutil.parser.parse(args.starting_date) + + total_days = delta.days + years = total_days / 365.25 + weeks = (total_days % 365.25) / 7 + + diff --git a/python-web-server b/python/python-web-server similarity index 100% rename from python-web-server rename to python/python-web-server diff --git a/quarantine-day-counter b/python/quarantine-day-counter similarity index 100% rename from quarantine-day-counter rename to python/quarantine-day-counter diff --git a/speedtest b/python/speedtest similarity index 100% rename from speedtest rename to python/speedtest