scripts

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit ca2f4c86045047346b00f36c876b1338eb517fd2
parent 0de9d7446ce71429d4bd8489620ff3aee5297d35
Author: Andrew Laack <andrew@laack.co>
Date:   Tue, 15 Jul 2025 21:12:13 -0500

Unsure if this is worthwhile. I find using neovim may be simpler than this form of scheduling...

Diffstat:
Apython-files/schedule.py | 132+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aresources/scheduling.txt | 11+++++++++++
Aschedule.sh | 2++
3 files changed, 145 insertions(+), 0 deletions(-)

diff --git a/python-files/schedule.py b/python-files/schedule.py @@ -0,0 +1,132 @@ +# This is the format I use: + +# - [ ] Typing - 08:45am - 10:30am +# - [ ] Meeting - 10:30am - 11:00am +# - [ ] Imbue - 11:30am - 01:00pm +# - [ ] BPP - 01:20pm - 02:00pm +# - [ ] Leetcode - 03:05pm - 04:20pm +# - [ ] Lift - 04:20pm - 05:00pm +# - [ ] Leetcode - 05:30pm - 06:00pm +# - [ ] Run - 06:30pm - 08:30pm +# - [ ] Schedule - 08:30pm - 09:30pm + +# how can I codify this? + +# things I am noticing: + # 1) Each event has one word. + # a) this allows for using the space character as a delimiter. I like that. + # 2) There is a certain degree of consistency + # a) I generally cycle through a set of ~10 options at any given time for things to do in a day. + # 3) Formatting + # a) spaces, not tabs + # b) columnar alignment + # c) 12hour time format with leading 0 + +# solution: + +# I could maintain a numbered list of things +# to select from. I then type the number of the item +# and if I need to specify some amount of time that isn't an hour, +# I can then add that as an additional argument. + +# I should maintain a text file. Each line has a different task +# python loads this and assigns line numbers + +# I type in what I want + +# I then get it to print everything by pressing enter at the end +# with no input specified + +###### ADDL. ###### + +# I should add squishify and pushbach. +# this will allow for the removal of an interval +# squishing the times for each other interval into that time + +# the pushback method allows for updating intervals so they don't +# overlap. + +import collections +import datetime +from typing import List + +ListItem = collections.namedtuple("ListItem", ["item", "hours"]) + +def time_to_string(time : datetime.datetime): + ret_str = "" + ret_str += time.strftime("%I:%M%p").lower() + return ret_str + + +def schedule_times(items : List[ListItem], start_time : datetime.datetime) -> List[str]: + + current_time = start_time + ret_ls = [] + + for item in items: + + current_str = f"- [ ] {item.item}" + current_str = f"{current_str.ljust(16, " ")}" + current_str += "- " + current_str += time_to_string(current_time) + current_str += " - " + + current_time += datetime.timedelta(hours=item.hours) + current_str += time_to_string(current_time) + + ret_ls.append(current_str) + + return ret_ls + +if __name__ == "__main__": + + start_time : datetime.datetime = datetime.datetime.now() + + items : List[ListItem] = [] + + f = open("/home/andrew/bin/resources/scheduling.txt", "r") + lines = f.readlines() + f.close() + + lines = [line.rstrip() for line in lines] + + + done = False + + while not done: + for index, line in enumerate(lines): + if index < 10: + print(f"[{index}] - {line}") + else: + print(f"[{index}] - {line}") + + print() + + user_input = input("Selection: ") + + print() + + + if user_input == "": + done = True + continue + + inp = user_input.split(" ") + item = inp[0] + hours = 1 + + + if len(inp) > 1: + hours = float(inp[1]) + + try: + num = int(item) + items.append(ListItem(lines[num], hours)) + except ValueError: + items.append(ListItem(item, hours)) + + formatted_schedule = schedule_times(items, start_time) + + for scheduled_item in formatted_schedule: + print(scheduled_item) + print() diff --git a/resources/scheduling.txt b/resources/scheduling.txt @@ -0,0 +1,11 @@ +Lift +Run +Shower +Eat +Meeting +Fluent +BPP +Typing +Leetcode +Encoder +DDIA diff --git a/schedule.sh b/schedule.sh @@ -0,0 +1,2 @@ +#!/bin/bash +python3 ~/bin/python-files/schedule.py