#!/usr/bin/perl use strict; use warnings; my @files = split("\n", `find .`); my $last_mod = 0; my $f_mod = 0; foreach my $file ( @files ) { my $mod_time = `stat $file | grep Modify | awk '{print \$2" "\$3}'`; chomp $mod_time; my $c = $mod_time; $c =~ tr/-\://d; $c =~ tr/ //d; if ( $c > $last_mod ) { $last_mod = $c; $f_mod = $mod_time; } } sub colorize($) { my $string = shift; # For "colorizing" the page my @fade_in_c_arr = ( 142,143,144,145,146,233,240,244,250, ); my $fade_len = @fade_in_c_arr; my @input_char_arr = split("", $string); my @colored_char_ar; foreach my $char ( @input_char_arr ) { if ( $char eq "\n" || $char eq " " || $char eq '\\' || $char eq '/' ) { push(@colored_char_ar,$char); next; } my $c = $fade_in_c_arr[rand @fade_in_c_arr]; push(@colored_char_ar, "\x1B[38;5;$c" . "m" . "$char" . "\x1B[0m"); } my $c_string = join("",@colored_char_ar); return $c_string; } sub printer($$$) { my $string = shift; my $type = shift; my $rest = shift; if ( defined $ENV{'QUERY_STRING'} && $ENV{'QUERY_STRING'} eq "plain" ) { print("$type$string$rest\n"); } else { my $c_string = colorize($string); print("$type$c_string$rest\n"); } } my $HOME_PATH = "/"; if ( defined $ENV{'QUERY_STRING'} && $ENV{'QUERY_STRING'} eq "plain" ) { $HOME_PATH = "/foobar.cgi?plain"; } # GOPHERMAP GEN HERE if ( defined $ENV{'QUERY_STRING'} && $ENV{'QUERY_STRING'} eq "plain" ) { print("i CHATE.IO\n"); } else { print("i ▄████▄ ██░ ██ ▄▄▄ ▄▄▄█████▓▓█████ ██▓ ▒█████\n"); print("i▒██▀ ▀█ ▓██░ ██▒▒████▄ ▓ ██▒ ▓▒▓█ ▀ ▓██▒▒██▒ ██▒\n"); print("i▒▓█ ▄ ▒██▀▀██░▒██ ▀█▄ ▒ ▓██░ ▒░▒███ ▒██▒▒██░ ██▒\n"); print("i▒▓▓▄ ▄██▒░▓█ ░██ ░██▄▄▄▄██░ ▓██▓ ░ ▒▓█ ▄ ░██░▒██ ██░\n"); print("i▒ ▓███▀ ░░▓█▒░██▓ ▓█ ▓██▒ ▒██▒ ░ ░▒████▒ ██▓ ░██░░ ████▓▒░\n"); print("i░ ░▒ ▒ ░ ▒ ░░▒░▒ ▒▒ ▓▒█░ ▒ ░░ ░░ ▒░ ░ ▒▓▒ ░▓ ░ ▒░▒░▒░\n"); print("i ░ ▒ ▒ ░▒░ ░ ▒ ▒▒ ░ ░ ░ ░ ░ ░▒ ▒ ░ ░ ▒ ▒░\n"); print("i░ ░ ░░ ░ ░ ▒ ░ ░ ░ ▒ ░░ ░ ░ ▒\n"); print("i░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░\n"); print("i░ ░\n"); print("i\n"); } printer(" _.-^ Thanks for visiting The Chateau ^-._","i",""); print("i\n"); printer(" Last Modification: $f_mod UTC","i",""); print("i\n"); printer("About Me","0","\tblogs/about-me.org.txt\tchate.io\t70"); printer("Ramblings and Phlog","1","\tblogs\tchate.io\t70"); print("i --> All posts are .org mode formatted,\n"); print("i so elpher users can use M-x org-mode\n"); print("i for nicer formatting\n"); print("i\n"); printer("Warez","1","\t$HOME_PATH\tchate.io\t70"); print("i --> http://ntfy.sh\n"); print("i - Awesome and very easy to use PUT/POST\n"); print("i based notification system\n"); print("i\n"); printer("Cool Places","i",""); printer(" --> baud.baby","1","\t/\tbaud.baby"); printer(" --> hngopher.com (HN Gopher Proxy)","1","\t/\thngopher.com"); printer(" --> Linkerror","1","\t/\tgopher.linkerror.com"); printer(" --> gopher.black","1","\t/\tgopher.black"); printer(" --> tilde.club","1","\t/\ttilde.club"); printer(" --> RPoD (1436.ninja)","1","\t/\t1436.ninja"); printer(" --> gopherpedia (Wikipedia Gopher Proxy)","1","\t/\tgopherpedia.com"); printer(" --> thelambdalab.xyz","1","\t/\tthelambdalab.xyz"); print("i\n"); printer("WhackyCGI","i",""); print("i\n"); printer("Script that generates this page","0","\t/foobar.txt\tchate.io\t70\n"); print("i\n"); print("1Plain\t/foobar.cgi?plain\tchate.io\t70\n"); print("1Colorized\t/foobar.cgi\tchate.io\t70\n"); print("iIf the site looks weird, use the Plain entry above\n"); print("iThis gopher site expects a client that either supports or\n"); print("ifilters ANSI escape sequences. I recommend:\n"); print("i--> cgo\n"); print("i--> phetch\n"); print("i--> curl (use gopher://)\n"); print("i--> Elpher (filters ANSI)\n");