calender shit

This commit is contained in:
deadvey 2024-11-13 20:27:22 +00:00
parent d1a259b0e0
commit fd574c6a7d

54
calender.py Normal file
View File

@ -0,0 +1,54 @@
from datetime import datetime
import sys
#Maths
day = datetime.now().timetuple().tm_yday # returns 1 for January 1st
year = datetime.now().year
year_hex = hex(year)[2:]
day_hex = hex(day)[2:]
if ((year % 4 == 0) and (year % 100 != 0)) or (year % 400 == 0):
leap_year = 1
else:
leap_year = 0
start_day = day
end_day = day + 32
if end_day > 366+leap_year:
end_day=366+leap_year
# Handle arguments
while (len(sys.argv) > 1):
if (sys.argv[1] == "--one"):
end_day = day + 32
if end_day > 366+leap_year:
end_day=366+leap_year
if sys.argv[1] == "--year":
start_day = 1
if sys.argv[1] == "--date-to-year":
end_day = 366+leap_year
# Printing
print(f" {year_hex}")
print("Prim Seco Tert Quad Quin Sext Sept Octo")
day_of_week_start = start_day % 8
for x in range(day_of_week_start-1):
print(" ", end="")
octal_counter = day_of_week_start -1
for x in range(start_day, end_day):
number = hex(x)[2:]
digits = len(number)
count = 4 - digits
for x in range(count):
print(" ", end="")
if (number == day_hex):
print("\033[101;1;5m", number, end="\033[0m")
else:
print(number, end=" ")
octal_counter+=1
if (octal_counter % 8 == 0):
print("")
print("\nPrim Seco Tert Quad Quin Sext Sept Octo")
print(f" {year_hex}")