Pythonesque

2024-11-26

I know a little about coding. Enough to sometimes brute force a small quality-of-life tweak into someone else’s code, or write a janky-as-heck shell script. But not enough to build anything substantial from the ground up.

So to fill this knowledge hole, I’ve been reading a few introductions to Python. And while learning in the abstract is a start, I didn’t have a project.

Until my research workflow fell over and I had to spend a couple afternoons in vim writing a replacement: a simple wrapper around Pandoc to make archiving webpages easier. I called it Jones. Because he was into archeology. And research is a kind of archeology. Anyway.

I’m putting the full code online as the internet equivalent of sticking it to my fridge. That way I can smile at its crudeness whenever I put away the milk. It’s on codeberg. Yeah, I’ve got one of those.

Bonus: Un-Pocket

Last time, I wanted to convert the list of links exported from Pocket into full text copies. That turned out to be pretty easy–I just needed htmlq. Then to get an unformatted list of links, I ran this in git-bash on Windows:

cat export.html |
htmlq --attribute href a |
sed '/^http/!d' > pocket.txt

And ran the list through Jones:

while IFS='' read -r line; do
    jones "$line"
done < pocket.txt