From 752a32a5aca73ce2df40e1a4518f5a3ca348e7d7 Mon Sep 17 00:00:00 2001
From: m
Date: Fri, 13 Mar 2026 19:31:46 +0100
Subject: [PATCH] backup
---
.vscode/settings.json | 3 +
edit_script/add_entry.py | 56 +++++++
edit_script/edit_entry.ipynb | 158 ++++++++++++++++++++
edit_script/note.html | 230 +++++++++++++++++++++++++++++
static/css/components/timeline.css | 31 ++++
test_style/expand_style.html | 90 +++++++++++
6 files changed, 568 insertions(+)
create mode 100644 .vscode/settings.json
create mode 100644 edit_script/add_entry.py
create mode 100644 edit_script/edit_entry.ipynb
create mode 100644 edit_script/note.html
create mode 100644 static/css/components/timeline.css
create mode 100644 test_style/expand_style.html
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..6b665aa
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "liveServer.settings.port": 5501
+}
diff --git a/edit_script/add_entry.py b/edit_script/add_entry.py
new file mode 100644
index 0000000..b5ea354
--- /dev/null
+++ b/edit_script/add_entry.py
@@ -0,0 +1,56 @@
+import datetime
+FIELDS = ['title', 'subtitle', 'content', 'displayall']
+def add_entry(file_path, title, subtitle, content, display_all=False):
+ # 1. Import the current list to get the latest ID
+ # We use a namespace to avoid path issues
+ namespace = {}
+ with open(file_path, 'r') as f:
+ exec(f.read(), namespace)
+
+ posts = namespace.get('BLOG_POSTS', [])
+ new_id = max([p['id'] for p in posts], default=0) + 1
+ print("new id", new_id)
+ # 2. Format the new entry string
+ date_str = datetime.datetime.now().strftime("%B %d, %Y")
+
+ new_post_str = f"""
+ {{
+ 'id': {new_id},
+ 'title': '{title}',
+ 'content': \"\"\"
+ {content}
+\"\"\",
+ 'subtitle': '{subtitle}',
+ 'date': '{date_str}',
+ "displayall": {display_all}
+ }},
+ """
+
+ # 3. Append to the file
+ # Note: This appends to the END of the file.
+ # If your file ends with ']', we need to strip that first.
+ with open(file_path, 'r+') as f:
+ content_full = f.read().strip()
+ # Find the last closing bracket of the list
+ if content_full.endswith(']'):
+ content_full = content_full.rsplit(']', 1)[0]
+
+ f.seek(0)
+ f.write(content_full + new_post_str + "\n]")
+ f.truncate()
+
+ print(f"Successfully added Post #{new_id}: {title}")
+
+# Usage
+if __name__ == "__main__":
+ #t = input("Title: ")
+ #s = input("Subtitle: ")
+ #c = input("Content (HTML): ")
+
+ # title
+ t = "I have a solution but it only works for spherical chickens in a vacuum!"
+ # subtitle
+ s = ""
+ # content
+ c = "no content"
+ add_entry('content/posts.py', t, s, c)
\ No newline at end of file
diff --git a/edit_script/edit_entry.ipynb b/edit_script/edit_entry.ipynb
new file mode 100644
index 0000000..72115ff
--- /dev/null
+++ b/edit_script/edit_entry.ipynb
@@ -0,0 +1,158 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "090c7992",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " im still struggling:\n",
+ "
\n",
+ " sudo pacman -S archlinux-keyring
\n",
+ " melange:
\n",
+ " \n",
+ "\n",
+ "Post 3 updated successfully.\n"
+ ]
+ }
+ ],
+ "source": [
+ "import datetime\n",
+ "\n",
+ "def get_entry(file_path, id):\n",
+ "\n",
+ " # 1. Import the current list to get the latest ID\n",
+ "\n",
+ " # We use a namespace to avoid path issues\n",
+ "\n",
+ " namespace = {}\n",
+ "\n",
+ " with open(file_path, 'r') as f:\n",
+ "\n",
+ " exec(f.read(), namespace)\n",
+ "\n",
+ " posts = namespace.get('BLOG_POSTS', [])\n",
+ "\n",
+ " for items in posts:\n",
+ "\n",
+ " if items.get(\"id\") == id:\n",
+ "\n",
+ " content = items.get('content')\n",
+ "\n",
+ " print(content)\n",
+ "\n",
+ " return items \n",
+ "\n",
+ "\n",
+ "\n",
+ "def update_entry(file_path, post_id, new_content):\n",
+ " # 1. Load the existing data into memory\n",
+ " namespace = {}\n",
+ " with open(file_path, 'r') as f:\n",
+ " exec(f.read(), namespace)\n",
+ " \n",
+ " posts = namespace.get('BLOG_POSTS', [])\n",
+ " \n",
+ " # 2. Find and update the specific post\n",
+ " found = False\n",
+ " for post in posts:\n",
+ " if post.get(\"id\") == post_id:\n",
+ " post['content'] = new_content\n",
+ " # Optional: Update the date or add an \"updated\" field\n",
+ " # post['subtitle'] += \" (Updated)\" \n",
+ " found = True\n",
+ " break\n",
+ " \n",
+ " if not found:\n",
+ " print(f\"Error: Post {post_id} not found.\")\n",
+ " return\n",
+ "\n",
+ " # 3. Write the entire list back to the file\n",
+ " # Using repr() or a loop to format it cleanly\n",
+ " with open(file_path, 'w') as f:\n",
+ " f.write(\"BLOG_POSTS = [\\n\")\n",
+ " for p in posts:\n",
+ " # Use .get() to provide a default value if the key is missing\n",
+ " display_val = p.get('displayall', False) \n",
+ " data_val = p.get('date', \"?\") \n",
+ " subtitle_val = p.get('subtitle', \"\") \n",
+ " \n",
+ " entry = f\"\"\" {{\n",
+ " 'id': {p['id']},\n",
+ " 'title': \"{p['title']}\",\n",
+ " 'subtitle': \"{subtitle_val}\",\n",
+ " 'date': \"{data_val}\",\n",
+ " 'content': \\\"\\\"\\\"{p['content']}\\\"\\\"\\\",\n",
+ " \"displayall\": {display_val}\n",
+ " }},\\n\"\"\"\n",
+ " f.write(entry)\n",
+ " f.write(\"]\\n\")\n",
+ " \n",
+ " print(f\"Post {post_id} updated successfully.\")\n",
+ "\n",
+ "# --- Usage Example ---\n",
+ "if __name__ == \"__main__\":\n",
+ " file = '../content/posts.py'\n",
+ " target_id = 3\n",
+ " \n",
+ " # Get the old one first to see it\n",
+ " old_post = get_entry(file, target_id)\n",
+ " \n",
+ " if old_post:\n",
+ " pass\n",
+ "\n",
+ " new_text=\"\"\"\n",
+ " sudo pacman -S archlinux-keyring
\n",
+ " sudo pacman -Sc
\n",
+ " melange:
\n",
+ " \n",
+ "\n",
+ "\n",
+ " \"\"\"\n",
+ " \n",
+ " \n",
+ " update_entry(file, target_id, new_text)\n"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "base",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.11.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/edit_script/note.html b/edit_script/note.html
new file mode 100644
index 0000000..87f8e1b
--- /dev/null
+++ b/edit_script/note.html
@@ -0,0 +1,230 @@
+
+
+
+
+
+ Pro Sticky Board (Safe Mode)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/static/css/components/timeline.css b/static/css/components/timeline.css
new file mode 100644
index 0000000..c681f1e
--- /dev/null
+++ b/static/css/components/timeline.css
@@ -0,0 +1,31 @@
+.timeline-button {
+ position: absolute;
+ left: -0.375rem;
+
+ width: 0.75rem;
+ height: 0.75rem;
+
+ border-radius: 9999px;
+
+ background: #d1d5db;
+
+ display: flex;
+ align-items: center;
+ justify-content: center;
+
+ font-size: 10px;
+ line-height: 1;
+
+ transition: all 0.2s ease;
+}
+
+/* hover only when expanded */
+.timeline-button:hover:not(.collapsed) {
+ background: #6b7280;
+}
+
+/* collapsed state */
+.timeline-button.collapsed {
+ background: transparent !important;
+ color: #6b7280;
+}
diff --git a/test_style/expand_style.html b/test_style/expand_style.html
new file mode 100644
index 0000000..b9f517f
--- /dev/null
+++ b/test_style/expand_style.html
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+ Home
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% block content %} {% endblock %}
+
+
+
+
+
+
+
+
+
+
+
+
+