diff --git a/minepig.cgi.go b/minepig.cgi.go index faf4007..836d82d 100644 --- a/minepig.cgi.go +++ b/minepig.cgi.go @@ -4,12 +4,13 @@ import ( "net" "fmt" "time" + "sync" ) const MAGIC = "\x00\xff\xff\x00\xfe\xfe\xfe\xfe\xfd\xfd\xfd\xfd\x12\x34\x56\x78" -func isAlive() bool { - conn, err := net.Dial("udp", "h.woozle.org:30919") +func isAlive(host string) bool { + conn, err := net.Dial("udp", host) if err != nil { return false } @@ -28,24 +29,54 @@ func isAlive() bool { return true } +var wg sync.WaitGroup + +func waitClose(c chan<- string) { + wg.Wait() + close(c) +} + +type HostEntry struct { + host string + owner string +} + +var hosts = []HostEntry{ + {"h.woozle.org:30919", "Ginnie"}, + {"h.woozle.org:44321", "Neale"}, + {"h.woozle.org:58000", "Amy"}, +} + +func ping(results chan<- string, e HostEntry) { + defer wg.Done() + if isAlive(e.host) { + results <- fmt.Sprintf("%s is playing at %s", e.owner, e.host) + } +} + func main() { + results := make(chan string, 5) + + for _, host := range hosts { + wg.Add(1) + go ping(results, host) + } + go waitClose(results) + fmt.Println("Content-type: text/html") fmt.Println("") fmt.Println("") fmt.Println("") fmt.Println("") fmt.Println("") - fmt.Println("") - fmt.Println("Is Ginnie playing Minecraft PE?") + fmt.Println("") + fmt.Println("Minecraft PE ping") fmt.Println("") - fmt.Println("

Is Ginnie playing Minecraft PE?

") - fmt.Println("

") - if isAlive() { - fmt.Println("yes") - } else { - fmt.Println("no") + fmt.Println("

Are The Picketts playing Minecraft PE?

") + fmt.Println("") fmt.Println("") } diff --git a/papers/longbets.mdwn b/papers/longbets.mdwn index 394e840..1211e1e 100644 --- a/papers/longbets.mdwn +++ b/papers/longbets.mdwn @@ -4,7 +4,62 @@ All bets are for $1. Neale's prediction is the one stated. Los Angeles Population (Blake) ------------------------------- +============================== On Feb 24, 2029, the metropolitan area commonly known as "Los Angeles" will have, at most recent measure, double-digit population decrease. + + +Neale's Rationale +----------------- + +LA uses a ton of fresh water, brought in from all over the place. +As droughts worsen, there will be increasingly large fights over water. +Regardless of the political outcome, +places closer to fresh water will tend to keep that water. +LA is not close to fresh water. +Las Vegas is going to have the same problem, +but predicting the collapse of Las Vegas didn't seem as challenging. + +------ + +This Page (Nemo Thorx) +====================== + + +By 7 December, 2028, Neale will have updated this web page +within the last 12 months. + + +Neale's Rationale +----------------- + +I actually think Nemo's right, +but this was such an amusing bet, +I couldn't turn it down. + +------ + +DC Power (Nobody yet!) +====================== + +By 2030, over ⅓ of US residences currently being built will be wired with a DC power bus. + + +Neale's Rationale +----------------- + +When I counted in 2014, we had only 5 electrical devices +that used Alternating Current. +Everything else ran off a "wall wart": +an AC to DC transformer. + +In addition to DC being tremendously safer +(it won't stop Junior's heart when he sticks a fork in a USB port), +it's also potentially more efficient to have a single transformer for the entire house. +As more houses move to solar power with battery storage, +the conversion from DC batteries to AC wall power, +just to be converted again to DC, +will be a tantalizing inefficiency to conquer. +And with the introduction in 2015 of USB delivering up to 100W, +there will even be a standard to use.