From ce43e13e15890fc11915237f77054fccb6608d98 Mon Sep 17 00:00:00 2001 From: Fredrik Robertsen Date: Sat, 6 Jun 2026 22:24:44 +0200 Subject: [PATCH] read paths and request tom and temmie --- cursed.coco | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/cursed.coco b/cursed.coco index 6fee6b8..82a9612 100644 --- a/cursed.coco +++ b/cursed.coco @@ -1,4 +1,32 @@ import requests +import os + +# substrings in path to exclude +EXCLUDES = [ + "wordpress" +] + +def read_lines(path: str) -> list[str]: + with open(path, 'r') as f: + return f.read().splitlines() + +# construct get-able url path +def parse_path(path: str) -> str: + # bet on `/home/pvv/_/` prefix + return "~" + path[12:] |> .replace("/web-docs", "") + +def include_path(path: str) -> bool: + return not any([x in path for x in EXCLUDES]) if __name__ == "__main__": - print("hello world") + filtered_paths = read_lines("out/cgi-paths.txt") |> map$(parse_path) |> filter$(include_path) |> list + + print("----- TOM -----") + tom_paths = filtered_paths |> map$("https://pvv.ntnu.no/"+.) |> list + tom_oks = tom_paths |> map$(requests.get) |> map$(x -> x.ok) |> list + zip(tom_oks, tom_paths) |> map$(x -> str(x[0]) + ":\t" + x[1]) |> "\n".join |> print + + print("----- TEMMIE -----") + tem_paths = filtered_paths |> map$("https://temmie.pvv.ntnu.no/"+.) |> list + tem_oks = tem_paths |> map$(requests.get) |> map$(x -> x.ok) |> list + zip(tem_oks, tem_paths) |> map$(x -> str(x[0]) + ":\t" + x[1]) |> "\n".join |> print