about summary refs log tree commit diff stats
path: root/non-empty-sites.sh
diff options
context:
space:
mode:
authorPadeso <padeso@duck.com>2024-11-27 14:29:09 +0000
committerPadeso <padeso@duck.com>2024-11-27 14:29:09 +0000
commit33bdbd42b5ba85144a3e702e2bf74bdb5e70c9c1 (patch)
tree89094e55abfc337ff550da69b5cd547a1bfa7550 /non-empty-sites.sh
parentb672d10b67204ddd9271f4cb8582dae57d14032e (diff)
downloadnon-empty-sites-33bdbd42b5ba85144a3e702e2bf74bdb5e70c9c1.tar.gz
Tweaks
Diffstat (limited to 'non-empty-sites.sh')
-rwxr-xr-xnon-empty-sites.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/non-empty-sites.sh b/non-empty-sites.sh
new file mode 100755
index 0000000..87647ac
--- /dev/null
+++ b/non-empty-sites.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+
+import array
+import sys
+import os
+from datetime import datetime
+
+sites_file = "./sites"
+mtime = datetime.fromtimestamp(os.path.getmtime(sites_file)).strftime("%Y-%m-%d %H:%M")
+
+sites_list = ['<ul class="sites">']
+with open(sites_file) as file:
+    for line in file:
+        l = line.rstrip()
+        sites_list.append("<li><a href='https://% s.tilde.institute/'>%s</a></li>" % (l, l))
+sites_list.append("</ul>")
+
+payload = ("<!doctype html>"
+           '<html lang="en">'
+           "<head>"
+           "<meta charset=\"utf-8\">"
+           "<title>Non-Empty Sites</title>"
+           "<link href='non-empty-sites.css' rel='stylesheet' type='text/css'"
+           "</head>"
+           "<body>"
+           "<h1>Apparently non-empty sites at tilde.institute</h1>"
+           '<p>As of {}, the following <b>tilde.institute</b> users had at least one file in their <i>public_html</i> folder, so you might find some sort of web site there.</p>'
+           "{}"
+           "<p>I put this together to learn something about writing shell and CGI scripts on tilde.institue. <a href='https://git.tilde.institute/padeso/non-empty-sites/'>[source]</a></p>"
+           "</body>"
+           "</html>").format(mtime, "".join(sites_list))
+print(payload)