Created
June 6, 2020 15:21
-
-
Save shindig7/38adb060eddd98b506edb042713edd1d to your computer and use it in GitHub Desktop.
Creates spaced repetition reminders for Roam Research (https://roamresearch.com/) at 1 day, 1 week, 1 month, 4 month, and 1 year intervals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime, timedelta | |
def get_reps(subject): | |
check = r"{{[[TODO]]}}" | |
suffix = ( | |
lambda d: "th" if 10 < d < 14 else {1: "st", 2: "nd", 3: "rd"}.get(d % 10, "th") | |
) | |
today = datetime.now() | |
rep1 = today + timedelta(days=1) | |
rep2 = today + timedelta(weeks=1) | |
rep3 = today + timedelta(weeks=4) | |
rep4 = today + timedelta(weeks=16) | |
rep5 = today + timedelta(days=365) | |
for r in [rep1, rep2, rep3, rep4, rep5]: | |
date_str = r.strftime(f"%B {str(r.day) + suffix(r.day)}, %Y") | |
print(f"{check} Review [[{subject}]] - [[{date_str}]]") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment