#!/usr/bin/env gsi-script (define (string-index where what) (letrec ((helper (lambda (index) (if (> (+ index (string-length what)) (string-length where)) #f (if (string=? (substring where index (+ index (string-length what))) what) index (helper (+ index 1))))))) (helper 0))) (define (string-replace where what with) (let ((ind (string-index where what))) (if ind (string-append (substring where 0 ind) with (string-replace (substring where (+ ind (string-length what)) (string-length where)) what with)) where))) (define (string-split what with) (let process ((splits '()) (str what)) (let ((ind (string-index str with))) (if ind (process (cons (substring str 0 ind) splits) (substring str (+ ind (string-length with)) (string-length str))) (reverse (cons str splits)))))) (display "HTTP/1.0 200 OK\n\n") (display "\n") (display "\n") (display "\n") (display "\n") (display "🌐 CYBERSPACE 🌐\n") (display "\n") (display "\n") (display "\n") (display "

🌐 CYBERSPACE 🌐

\n") (display "
\n") (display "
\n") (let ((n (car (string-split (cdr (shell-command "ls /home | wc -l" #t)) "\n")))) (display (string-append "

Cybermen (" n ")

\n"))) (display "\n") (display "
\n") (display "
\n") (display "

Cyberactivity

\n") (display "\n") (display "") (let ((latest-10-pages (filter (lambda (s) (not (string=? s ""))) (string-split (cdr (shell-command "for d in $(ls /home) ; do [ -d \"/home/$d/public_html\" ] && find \"/home/$d/public_html\" -type f \\( -name '*.html' -o -name '*.pdf' -o -name '*.cgi' \\) -printf \"%T+ %p\n\"; done | sort -r | head -n10" #t)) "\n")))) (for-each (lambda (x) (let ((when (car (string-split x "."))) (who (car (string-split (cadr (string-split x "/home/")) "/public"))) (what (cadr (string-split x "/public_html/")))) (display (string-append "\n")))) latest-10-pages)) (display "
WhenWhoWhat
" (string-append (car (string-split when "+")) " @ " (cadr (string-split when "+"))) "" (string-append "" who "") "" (string-append "" what "") "
\n") (display "

Cybermosaic

\n") (display "Bird's eye view of the entire cyberspace.\n") (display "

Cyberconsciousness

\n") (display "Cyperconsciousness as tracked by GCP3 is deemed to be \"https://gcp3.net/mr\".\n") (display "

Cyberstatus

\n") (let ((uptime (cdr (shell-command "uptime" #t)))) (if (string-index uptime "days") (let ((up-days (car (string-split (cadr (string-split uptime "up ")) " days"))) (up-hours (car (string-split (cadr (string-split uptime "days")) ":")))) (display (string-append "Cyberspace has been 🟢 for " up-days " days and " up-hours " hours.\n"))) (display "Cuberspace is 🟢 again!\n"))) (display "
\n") (display "
\n") (display "
\n") (display "

The cyberreport has been generated automatically with this script.

") (display "
\n") (display "\n") (display "\n")