Back to posts

Day 6 of the 2024 Old Computer Challenge

Well, the CrowdStrike thing impacted work a little today, but not so much the challenge - score 1 for Old Computers!

I got emailed a 9.8MB image today and spent much of my time trying to figure out how to open it. It takes too much memory to show it in flpicsee and ImageMagick has 12MB of dependencies so won't load either. All the image shrinking websites require JS, apart from one that I found that seemed to go down after my first try with it (sorry whoever runs that site). This one has me stumped. I'll have to wait until Sunday to view it.

I tweaked my RSS/Atom scripts so that I could view today's xkcd and Randall was quick off the mark with today's - normally it's up in the evening or so, but he managed to get something on the CrowdStrike thing out by afternoon! Anyway, my new processor for Xidel is the following:

#!/bin/sh
tohtml() {
  sh ./feed-to-html.sh "xml/$(basename "$1")" > "html/$(basename "$1" .xml).html"
}

fsize() {
  ls -l "$1" | awk '{print $5}'
}

getlbd() {
  xidel "$1" --extract '(
      if (//*:lastBuildDate != "")
      then inner-html(//*:lastBuildDate)
      else if (//*:channel/*:pubDate)
           then inner-html(//*:channel/*:pubDate)
           else inner-html(//*:feed/*:updated)
  )'
}
gettitle() {
  xidel "$1" --extract '(
      if (//*:channel != "")
      then inner-html(//*:channel/*:title)
      else inner-html(//*:feed/*:title)
  )'
}

echo "<!DOCTYPE html>">index.html
echo "<html><head><title>Feeds $(date)</title></head><body><h1>Feeds $(date)</h1><ol>">>index.html
for i in $(ls -1 xml/*); do
  echo "$i"
  wcl="$(wc -l "$i"|awk '{print $1}')"
  echo $wcl
  if (test "$wcl" -gt 1 || test "$(fsize "$i")" -gt 10 ) && test "$wcl" -lt 25000; then
    tohtml "$i"
    echo "<li><a href=\"html/$(basename "$i" ".xml").html\">$(gettitle "$i") ($(getlbd "$i"))</a></li>">>index.html
  fi
done
echo "</ol></body></html>">>index.html

It's still a bodge (even bodgier now), but it works better this way.

It's been very hot today, especially in a south-facing room, so not that pleasant to use an old computer that's kicking out a lot of heat. Fortunately, it's cooling off now.