#!/usr/bin/env ruby require 'cgi' def llink(href, text) if $cgi.path_info == href $cgi.a(href) { "[ #{text} ⇓ ]" } else $cgi.a(href) { "[ #{text} ]" } end end def rlink(href, text) $cgi.a(href: href, target: "_blank") { "[ #{text} ⇗ ] " } end def toplinks $cgi.table(id: "toplinks") { $cgi.tr { $cgi.td { llink("/" , "Home" ) } + $cgi.td { rlink("https://git.4574.co.uk/", "Git" ) } + $cgi.td { llink("/stuff-i-want" , "Stuff I Want") } } } end def rquote [ "~ sweet ~", "User_4574 uses Linux, and loves life.", "User_4574 shall arrange the blocks and toil, for ever and a day.", "User_4574 likes the number 7.", "ex scientia veritas", "User_4574 will blow things up for money.", "User_4574 dreams it possible.", "(define (! ?) (? ?)) (! !)", "User_4574 lets her pain fade down.", "User_4574 maintains vigilance during disablement conditions.", "User_4574 is established on the localiser.", "Memetic Hazard.", "Every six months User_4574 checks the oil level of the drive housing, and if necessary tops up with IBM 15 to the level of the inspection hole.", "User_4574 remembers tomorrow.", "User_4574 <3s OpenBSD", "Expectation is directly proportional to performance.", "User_4574 is taking hits! Hull strength falling.", "User_4574 is not on fire.", "User_4574 syncs on green.", "User_4574 always reads the plaque.", "User_4574's work ethic is IEFBR14.", "User_4574 clears the link pack area.", "vivat diu et prosperet.", "The White Zone is for loading and unloading only.", "User_4574 copies run start.", "User_4574 shows standby brie.", "All hail the glow cloud.", "User_4574 tries at all times, without surrender, to be on good terms with all people.", "This is Delta Team. All production is down, repeat, all production is down.", "User_4574 glows in the dark turning dust to gold.", "NAT is evil.", "User_4574 chooses to have the ball in hand behind the headstring.", "User_4574 likes to think she could make Knuth cry if she wanted to.", "Due to a lack of interest, tomorrow has been cancelled. We apologize for any inconvenience caused.", "This is the panic office: Section 9-17 may have been hit. Activate the following procedure.", "Nothing, and everything, is possimpable." ].sample end def page(title, jumbotitle = title) load "#{title.downcase.gsub(?\s, ?-)}.cgi" $cgi.out { $cgi.html { $cgi.head { $cgi.title { "User_4574's Lair / #{title}" } + $cgi.link(rel: "stylesheet", href: "styles.css") } + $cgi.body { $cgi.h1("class" => "jumbo") { jumbotitle } + $cgi.div { toplinks } + $page + $cgi.div(id: "quote") { rquote } } } } end $cgi = CGI.new("html5") case $cgi.path_info when "/" page("Home", "User_4574's Lair") when /^\/stuff-i-want/ page("Stuff I Want") when /^\/bv/ $cgi.out("status" => "MOVED", "Location" => "https://bv.miller.cm/") {""} end