about summary refs log tree commit diff stats
path: root/non-empty-sites.sh
blob: 87647aca429f827bdf33e4ab70bf1d80a6bfd519 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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)
span class="m">666 $(DBDIR)/clinte.db @echo @echo ...Done! .PHONY: test test: @echo @echo Running tests... @echo cargo test @echo @echo ...Done! .PHONY: uninstall uninstall: @echo @echo Uninstalling clinte... @echo @echo Removing files rm -f $(BINDIR)/clinte @echo @echo ...Done\!