💾 Archived View for krauserd.xyz › src › index.gmi captured on 2023-01-29 at 02:14:07. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-03-01)

➡️ Next capture (2023-05-24)

-=-=-=-=-=-=-

David Krauser's Gemini Capsule

gemini://krauserd.xyz

Index Source Code

This Gemini capsule is somewhat dynamic. It has a user visit count, and each page is generated on-the-fly from files on disk. These are the hacky bits that make the index page:


#!/bin/sh

echo -n 1 >> count
count=$(wc -c count | cut -d' ' -f1)

unix2dos < header.gmi

unix2dos << EOF

You are visitor #$count to this capsule today:
=> ./stats/ Capsule Statistics


# Logbook
This is a collection of random thoughts, hacks, and ideas in reverse chronological order. I don't have an atom feed for these, yet, but I plan to add one at some point.

EOF

for log in $(ls logs/*.gmi | grep -v index | sort -r); do
  sed 1q $log | unix2dos
  timestamp=$(sed '1d;2q' $log)
  slug=$(basename $log)
  /usr/bin/echo -ne '=> gemini://krauserd.xyz/logs/index.gmi?'${slug%%.gmi}' '$timestamp' ∞\r\n'
  sed 1,2d $log | unix2dos
  /usr/bin/echo -ne '\r\n\r\n'
done

/usr/bin/echo -ne '=> gemini://krauserd.xyz/src/index.gmi Source code for this page\r\n'
unix2dos < footer.gmi

Licensed under CC BY-SA 4.0