Merge pull request #1 from delfuego/recently-updated-pages

Recently updated pages (Looks good.)
This commit is contained in:
Paul Ford 2014-10-04 14:08:24 -04:00
commit a1c04ce584
5 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,11 @@
# Recently-Updated Page Shell Scripts
As soon as [~ford](http://tilde.club/~ford) granted me entrance to tilde.Club, I knew that I wanted to keep tabs on what cool things folks were doing there. And thinking back to the mid-90s, what was the best way to know what was new on a site? A recently-updated page! So I set about making one for tilde.club.
There's no question at all that this is a rudimentary hack, but it's the *exact* sort of hack that was The Way To Do Things on the mid-90s Internet. (Note that that's the mid-90s-capital-I-Internet, not the [21st-century-lowercase-i-internet](http://www.nytimes.com/2002/12/29/weekinreview/29SCHW.html).) And I'm using tried-and-true command-line Unix filesystem commands to grab, parse, and sort the list of pages, so I feel like I'm treading in the footsteps of thousands before me. The result is [the list of all tilde.club pages updated in the last 24 hours](http://tilde.club/~delfuego/tilde.24h.html), which is generated from the ```findmod.sh``` shell script once a minute from a crontab job.
Of course, while the HTML version of the recently-updated list is firmly mid-90s (well, if you view source you'll see that it's 21st-century HTML5, but still), enabling cooler 21st-century functionality required making the same list available in a more easily-parsed format. Enter JSON, and the [API version of the recently-updated list](http://tilde.club/~delfuego/tilde.24h.json), generated by the ```findmod-json.sh``` shell script once a minute via crontab as well.
Hope these are useful to someone!
Jason Levine, aka [~delfuego](http://tilde.club/~delfuego)

View File

@ -0,0 +1,2 @@
#!/bin/bash
find /home/*/public_html -regex "/home/\_?[0-9a-zA-Z]*/public_html/index.html" -type f -name "index.html" -mtime 0 -printf '%T@ %p %TD %Tr %TY-%Tm-%TdT%TTZ\n' 2> /dev/null | sort -r | perl -CSD -pe 'BEGIN { print "{ \"pagelist\": [ \n"; }; END { print "] }\n"; }; if ($i > 0) { print ", "; }; s|([0-9\.]+) /home/([\p{L}\p{N}_]*?)/public_html/index.html (.*) (.*)|{ "username": "$2", "homepage": "http://tilde.club/~$2/", "modtime": "$4" }|; $i++'

View File

@ -0,0 +1,5 @@
#!/bin/bash
cat /home/delfuego/bin/header.tpl
find /home/*/public_html -regex "/home/\_?[0-9a-zA-Z]*/public_html/index.html" -type f -name "index.html" -mtime 0 -printf '%T@ %p %TD %Tr %TY-%Tm-%TdT%TTZ\n' 2> /dev/null | sort -r | perl -CSD -pe 's|([0-9\.]+) /home/([\p{L}\p{N}_]*?)/public_html/index.html (.*) (.*)|<li><a class="homepage-link" href="http://tilde.club/~$2">$2</a> <time datetime="$4">$3</time></li>|'
cat /home/delfuego/bin/footer.tpl

View File

@ -0,0 +1,4 @@
</ul>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>tilde.24h</title>
</head>
<body>
<h1>tilde.club home pages updated in last 24 hours</h1>
<div>There's also <a href="./tilde.24h.json">a JSON version of this data</a>; it's all updated once a minute, so hold yer damn horses, people. Also, times are in the server's time zone (GMT, it appears).</div>
<ul>