]> git.rmz.io Git - dotfiles.git/commitdiff
zsh: Calendar Facts MOTD
authorSamir Benmendil <me@rmz.io>
Tue, 19 Dec 2017 00:56:20 +0000 (00:56 +0000)
committerSamir Benmendil <me@rmz.io>
Tue, 19 Dec 2017 00:58:33 +0000 (00:58 +0000)
See https://www.xkcd.com/1930/

zsh/lib/motd.zsh

index ca345fa76c0df4c49fb14e4b4525ea5a4518b828..24eef9c8e0b7514c25a9a9624a26c0e2221b5a5d 100644 (file)
@@ -10,6 +10,78 @@ msg()
   print "$fg_bold[white]$1$reset_color\n$2\n"
 }
 
   print "$fg_bold[white]$1$reset_color\n$2\n"
 }
 
-short "[count][\"x]gr{motion}" 'Replace {motion} text with the contents of register x.'
-short "gn" "Like \`n\`, but start Visual mode to select the match. If an operator is pending, operates on the match."
-short "K" "If ft=gitrebase => show diff of commit"
+function () {
+    function c()
+    {
+        local rand=$(od -An -t u1 -N1 /dev/urandom)
+        local idx=$((1 + (rand % $#)))
+        echo ${@[$idx]}
+    }
+
+    recurring_event=(
+        "the $(c fall spring) equinox"
+        "the $(c winter summer) $(c solstice olympics)"
+        "the $(c erliest latest) $(c sunrise sunset)"
+        "the daylight $(c saving savings) time"
+        "the leap $(c day year)"
+        "easter"
+        "the $(c harvest super blood) moon"
+        "Toyota Truck Month"
+        "Shark Week"
+    )
+    drifters=(
+        sun
+        moon
+        zodiac
+        "$(c gregorian mayan lunar iPhone) calendar"
+        "atomic clock in Colorado"
+    )
+    unusual_manner=(
+        "happens $(c earlier later "at the wrong time") every year"
+        "drifts out of sync with the $(c ${drifters[@]})"
+        "might $(c "not happen" "happen twice") this year"
+    )
+    ions_and_ities=(precession libration nutation libation eccentricity obliquity)
+    iees_and_itees=(
+        moon
+        sun
+        "earth's axis"
+        equator
+        "prime meridian"
+        "$(c "international date" "Mason-Dixon") line"
+    )
+
+    phenomenon=(
+        "time zone legislation in $(c Indiana Arizona Russia)"
+        "a decree by the Pope in the 1500s"
+        "$(c ${ions_and_ities[@]}) of the $(c ${iees_and_itees[@]})"
+        "magnetic field reversal"
+        "an arbitrary decision by $(c "Benjamin Franklin" "Isaac Newton" "FDR")"
+    )
+    excuse=(
+        "will never happen"
+        "actually makes things worse"
+        "is stalled in congress"
+        "might be unconstitutional"
+    )
+    statement=(
+        "it causes a predictable increase in car accidents"
+        "that's why we have leap seconds"
+        "scientists are really worried"
+        "it was even more extreme during the $(c "bronze age" "ice age" cretaceous 1990s)"
+        "there's a proposal to fix it, but it $(c ${excuse[@]})"
+        "it's getting worse and no one knows why"
+    )
+    consequence=(
+        "causes huge headaches for software developers"
+        "is taken advantage of by high-speed traders"
+        "triggered the 2003 Northeast Blackout"
+        "has to be corrected for by GPS satellites"
+        "is now recognized as a major cause of World War I"
+    )
+    autoload zmathfunc
+    which zsh_math_func_min >/dev/null || zmathfunc
+    echo -n "Did you know that $(c ${recurring_event[@]}) $(c ${unusual_manner[@]})" \
+        "because of $(c ${phenomenon[@]})?  Apparently $(c ${statement[@]}). " \
+        "While it may seem like trivia, it $(c ${consequence[@]})." | fmt -w $((min(COLUMNS, 80)))
+}