summaryrefslogtreecommitdiff
path: root/weblog/a-new-post-script.md
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-07-11 23:19:23 -0600
committert <t@tjp.lol>2026-07-12 00:30:48 -0600
commit46a331dae8db622a491466ca9a0df3a5937ca80f (patch)
treeca769df8709cf47da2b728d6c7f2be4a0603b2ef /weblog/a-new-post-script.md
parent3f1234670b04161d211168a3af4bc85a1de99313 (diff)
back-port gemini capsule gemlog
Diffstat (limited to 'weblog/a-new-post-script.md')
-rw-r--r--weblog/a-new-post-script.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/weblog/a-new-post-script.md b/weblog/a-new-post-script.md
new file mode 100644
index 0000000..c4ad068
--- /dev/null
+++ b/weblog/a-new-post-script.md
@@ -0,0 +1,30 @@
+---
+post_date: 2023-05-09
+---
+
+# A new-post script
+
+I got to take a new "newpost" script for a spin just now and was really pleased with it.
+
+It:
+- Moves the post file into my gemlog directory, renaming it in the process according to the date and the title, which it pulls from the first H1 in the post.
+- Adds a link to the post to my index/homepage. I bail out to python for this since it's a little heavier - more on that in a minute.
+- Alerts Antenna to the index page change. This is probably where 90% of the value comes in.
+
+## Mixing languages
+
+Now I'm feeling a little motivated to evict python from this script, because there's some friction in doing this task partly in bash and partly in python.
+
+Python isn't the greatest scripting language for one-liners, and using the -c switch isn't really useful any more beyond that. So for now this script (1) creates a tempfile, (2) dumps mostly hard-coded python into it (from a bash HEREDOC), (3) executes it, (4) captures the return code, (5) unconditionally removes the tempfile, and (6) exits the script if the return code was unsatisfactory. That's...not great.
+
+Although as I type this I guess I can probably execute "python" directly on a named pipe with bash `<(cat <<EOF ...)` syntax? That's worth a shot.
+
+EDIT: it was worth a shot, it works great.
+
+## Automating Antenna
+
+Where I *really* wanted to get with this script was something I could run which would unify (a) posting a new post, and (b) sending a request to antenna to alert it to the new post. If this isn't one-and-the-same step from a workflow standpoint, I will *definitely* forget to do the second part. And in the future, if more active aggregators in the Antenna style pop up, I can add them to the script once and have them integrated from there on out.
+
+Shoddy multi-language paradigm or not, it was a pretty big and important step to get *some* automation in place.
+
+> Note: This was ported from my old gemini capsule, still served on gemini at `gemini.ctrl-c.club/~tjp`