diff options
Diffstat (limited to 'cgi')
-rw-r--r-- | cgi/home.cgi | 33 | ||||
-rw-r--r-- | cgi/stuff-i-want.cgi | 32 | ||||
-rwxr-xr-x | cgi/user.cgi | 94 |
3 files changed, 159 insertions, 0 deletions
diff --git a/cgi/home.cgi b/cgi/home.cgi new file mode 100644 index 0000000..509d188 --- /dev/null +++ b/cgi/home.cgi @@ -0,0 +1,33 @@ +require "json" +require "net/http" +require "time" + +def next_collection + uri = URI("https://waste-api.york.gov.uk/api/Collections/GetBinCollectionDataForUprn/***REMOVED***") + resp = JSON.parse(Net::HTTP.get(uri))["services"].select { |c| Time.parse(c["nextCollection"]) > Time.now }.sort { |a, b| Time.parse(a["nextCollection"]) <=> Time.parse(b["nextCollection"]) }[0] + + case resp["service"] + when "REFUSE" + "REFUSE" + when "RECYCLING" + "<font color=\"green\">RECYCLING</font>" + when "GARDEN" + "<font color=\"brown\">GARDEN WASTE</font>" + end + + " on #{resp["nextCollection"].split('T')[0]}" +end + +$page = + $cgi.div { $cgi.h1 { "Welcome!" } } + + $cgi.div { + $cgi.h2 { "Next Bin Collection" } + + $cgi.p { next_collection } + } + + $cgi.div { + $cgi.h2 { "Speak Gently Over the Telephone" } + + $cgi.blockquote { "It is one of the commonest as well as one of the most amusing human idiosyncrasies to imagine that the louder one shouts into the transmitter of a telephone the more perfectly and comfortably does the sound reach the person at the other end. Great numbers of people who in the ordinary affairs of life are tranquil and soft-toned, will habitually yell into a telephone receiver as if they were rooting for the home team. These are, perhaps the same people who think that he who has not the remotest knowledge of English can grasp it without difficulty if only it is shouted at him loudly enough. The theory that prompts vociferousness in the one case is as false as that which prompts it in the other.<br /><br /> +If a person does not understand English, no amount of shouting will make him understand it. If he understands a little English, he can best make out what another is saying to him when the other is calm. If he understands English very well, he will appreciate whatever is said to him all the more if it is not said in the key at which one usually hails a boat 300 yards off shore on a windy day.<br /><br /> +It is the same way with a telephone. If it is entirely out of order there is no more sense in yelling into the transmitter than there would be in hallooing at the moon. If it is not working well, this can be best overcome by patience strongly reinforced with clear enunciation. If it is working properly, the person at the other end can hear most distinctly when the tone employed is that used in ordinary conversation among decent people.<br /><br /> +— Christian Science Monitor" } + + $cgi.p { "From Bell Telephone News, Volume 2, Number 7, Page 18." } + } diff --git a/cgi/stuff-i-want.cgi b/cgi/stuff-i-want.cgi new file mode 100644 index 0000000..77bf720 --- /dev/null +++ b/cgi/stuff-i-want.cgi @@ -0,0 +1,32 @@ +$page = + $cgi.div { + $cgi.h2 { "Wishlists" } + + $cgi.h3 { "Amazon" } + + $cgi.ul { + $cgi.li { $cgi.a(href: "https://www.amazon.co.uk/hz/wishlist/ls/3SB878GWKV1OG", target: "_blank") { "Books" } } + + $cgi.li { $cgi.a(href: "https://www.amazon.co.uk/hz/wishlist/ls/2N0PIE381SAVM", target: "_blank") { "Board Games" } } + + $cgi.li { $cgi.a(href: "https://www.amazon.co.uk/hz/wishlist/ls/3HVX4XFFH7TFR", target: "_blank") { "Misc" } } + } + + $cgi.h3 { "DriveThruRPG" } + + $cgi.ul { + $cgi.li { $cgi.a(href: "https://www.drivethrurpg.com/wishlist_public.php?public_id=3288195&list_id=3986366", target: "_blank") { "Rolplaying Games" } } + } + + $cgi.h3 { "Master of Malt" } + + $cgi.ul { + $cgi.li { $cgi.a(href: "https://www.masterofmalt.com/lists/buy-niuan-paque/", target: "_blank") { "Whisky" } } + + $cgi.li { $cgi.a(href: "https://www.masterofmalt.com/lists/denis-cheet-glynn/", target: "_blank") { "Not Whisky" } } + } + + $cgi.h3 { "Steam" } + + $cgi.ul { + $cgi.li { $cgi.a(href: "https://store.steampowered.com/wishlist/profiles/76561197996305593/#sort=order&ex_earlyaccess=1&ex_prerelease=1", target: "_blank") { "Video Games" } } + } + } + + $cgi.div { + $cgi.h2 { "Things" } + + $cgi.ul { + $cgi.li { $cgi.a(href: "https://eater.net/shop", target: "_blank") { "Ben Eater's Complete 8-bit breadboard computer kit bundle" } } + + $cgi.li { $cgi.a(href: "https://drop.com/buy/drop-mt3-dasher-keycap-set/?defaultSelectionIds=967197", target: "_blank") { "DROP MT3 Dasher keycap set" } } + + $cgi.li { $cgi.a(href: "https://shop.darkwoodscoffee.co.uk/collections/courses-and-events/products/sca-foundation-brewing-course?variant=12969866133548", target: "_blank") { "SCA Foundation Coffee Brewing Course" } } + + $cgi.li { $cgi.a(href: "https://www.hamradiostore.co.uk/mrq800-triband-6-2-70-mobile-antenna", target: "_blank") { "Moonraker 6/2/70 Whip" } } + } + } diff --git a/cgi/user.cgi b/cgi/user.cgi new file mode 100755 index 0000000..00589e6 --- /dev/null +++ b/cgi/user.cgi @@ -0,0 +1,94 @@ +#!/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") +end |