💾 Archived View for pub.phreedom.club › ~milkspace › wall_code.gmi captured on 2023-12-28 at 15:56:10. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-04-19)
-=-=-=-=-=-=-
DIRECTORY = "path/to/folder/with/wall/inscriptions"
#!/bin/python3 import os from config import DIRECTORY print("20 text/gemini; charset=utf-8") count = 32 inscriptions = os.listdir(DIRECTORY) if not inscriptions: print("Тут пусто") else: print(f"=> wall_full.cgi полная версия стены ({len(inscriptions)} записей)") print("=> statistic.cgi статистика стены") print(f"Последние {count} записи:\n") for inscription in sorted(inscriptions)[-1 * count:]: with open(f'{DIRECTORY}/{inscription}') as f: print(f.read(), '\n') print("=> write_something.cgi Написать что-нибудь")
#!/bin/python3 import os from config import DIRECTORY # DIRECTORY = "cgi-bin/python/wall/inscriptions" print("20 text/gemini; charset=utf-8") inscriptions = os.listdir(DIRECTORY) if not inscriptions: print("Тут пусто") else: print("На стене написано:\n") for inscription in sorted(inscriptions): with open(f'{DIRECTORY}/{inscription}') as f: print(f.read(), '\n') print("=> write_something.cgi Написать что-нибудь")
#!/bin/python3 import os import urllib.parse import datetime from config import DIRECTORY query = os.environ.get("QUERY_STRING") if not query: print("10 Enter something") else: print("20 text/gemini") text = urllib.parse.unquote(query) formatted_text_counter = 0 for i in text.split("\n"): if i.startswith("```"): formatted_text_counter += 1 if formatted_text_counter % 2 != 0: text += "\n```" with open( f"{DIRECTORY}/{datetime.datetime.now()}", 'w') as f: f.write(text) print(f"Вы написали:\n{text}\nи оставили свой след в истории этой стены\n" f"=> wall.cgi Вернуться обратно\n" f"(если ваша запись не видна, обновите страницу)")
#!/bin/python3 import os from collections import Counter from config import DIRECTORY print("20 text/gemini; charset=utf-8") inscriptions = os.listdir(DIRECTORY) data = [i.split()[0] for i in sorted(inscriptions, reverse=True)] counter = Counter(data) for i in counter: print(i, "☀" * counter[i])