💾 Archived View for krauserd.xyz › src › index.gmi captured on 2024-03-21 at 14:59:39. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous 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

I am a software engineer living in FL with my wife, three boys, a cat, and a dog. I love free software, simple technologies, and a good cup of coffee.



## Logbook

This is a collection of random thoughts, hacks, and ideas in reverse chronological order. I don't have a 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
  title=$(sed 1q $log | cut -c5-) # | unix2dos
  timestamp=$(sed '1d;2q' $log)
  slug=$(basename $log)
  /usr/bin/echo -ne '=> gemini://krauserd.xyz/logs/index.gmi?'${slug%%.gmi}' '$timestamp' - '$title'\r\n' # - '$timestamp' ∞\r\n'
  #sed 1,2d $log | unix2dos
  #/usr/bin/echo -ne '\r\n\r\n'
done

/usr/bin/echo -ne '\r\n\r\n\r\n'
unix2dos < contact.gmi

/usr/bin/echo -ne '\r\n\r\n\r\n'
unix2dos < leo.gmi

unix2dos << EOF

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

/usr/bin/echo -ne '\r\n\r\n\r\n'
/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