quantii-adaptive-programming/.automate/observation_create.py

31 lines
615 B
Python

import random
import string
import datetime
def generate_hash():
return ''.join(random.choices(string.ascii_lowercase + string.digits, k=8))
def create_observation(topic):
date = datetime.date.today().strftime("%Y-%m-%d")
hash = generate_hash()
filename = f"content/observations/{topic}-observation-{date}-{hash}.md"
with open(filename, 'w') as f:
f.write(f"""---
title: {topic} Observation
date: {date}
tags: [observation, {topic}]
---
# {topic} Observation
[Your content here]
""")
print(f"Created new observation: {filename}")
# Usage
create_observation("UserInterface")