]> git.rmz.io Git - dotfiles.git/blob - zsh/lib/motd.zsh
vim: use eunuch instead of my own "write as root" cabbrev
[dotfiles.git] / zsh / lib / motd.zsh
1 autoload colors; colors;
2
3 short()
4 {
5 print "$fg_bold[white]$1$reset_color $2"
6 }
7
8 msg()
9 {
10 print "$fg_bold[white]$1$reset_color\n$2\n"
11 }
12
13 function () {
14 function c()
15 {
16 local rand=$(od -An -t u1 -N1 /dev/urandom)
17 local idx=$((1 + (rand % $#)))
18 echo ${@[$idx]}
19 }
20
21 recurring_event=(
22 "the $(c fall spring) equinox"
23 "the $(c winter summer) $(c solstice olympics)"
24 "the $(c erliest latest) $(c sunrise sunset)"
25 "the daylight $(c saving savings) time"
26 "the leap $(c day year)"
27 "easter"
28 "the $(c harvest super blood) moon"
29 "Toyota Truck Month"
30 "Shark Week"
31 )
32 drifters=(
33 sun
34 moon
35 zodiac
36 "$(c gregorian mayan lunar iPhone) calendar"
37 "atomic clock in Colorado"
38 )
39 unusual_manner=(
40 "happens $(c earlier later "at the wrong time") every year"
41 "drifts out of sync with the $(c ${drifters[@]})"
42 "might $(c "not happen" "happen twice") this year"
43 )
44 ions_and_ities=(precession libration nutation libation eccentricity obliquity)
45 iees_and_itees=(
46 moon
47 sun
48 "earth's axis"
49 equator
50 "prime meridian"
51 "$(c "international date" "Mason-Dixon") line"
52 )
53
54 phenomenon=(
55 "time zone legislation in $(c Indiana Arizona Russia)"
56 "a decree by the Pope in the 1500s"
57 "$(c ${ions_and_ities[@]}) of the $(c ${iees_and_itees[@]})"
58 "magnetic field reversal"
59 "an arbitrary decision by $(c "Benjamin Franklin" "Isaac Newton" "FDR")"
60 )
61 excuse=(
62 "will never happen"
63 "actually makes things worse"
64 "is stalled in congress"
65 "might be unconstitutional"
66 )
67 statement=(
68 "it causes a predictable increase in car accidents"
69 "that's why we have leap seconds"
70 "scientists are really worried"
71 "it was even more extreme during the $(c "bronze age" "ice age" cretaceous 1990s)"
72 "there's a proposal to fix it, but it $(c ${excuse[@]})"
73 "it's getting worse and no one knows why"
74 )
75 consequence=(
76 "causes huge headaches for software developers"
77 "is taken advantage of by high-speed traders"
78 "triggered the 2003 Northeast Blackout"
79 "has to be corrected for by GPS satellites"
80 "is now recognized as a major cause of World War I"
81 )
82 autoload zmathfunc
83 which zsh_math_func_min >/dev/null || zmathfunc
84 echo -n "Did you know that $(c ${recurring_event[@]}) $(c ${unusual_manner[@]})" \
85 "because of $(c ${phenomenon[@]})? Apparently $(c ${statement[@]}). " \
86 "While it may seem like trivia, it $(c ${consequence[@]})." | fmt -w $((min(COLUMNS, 80)))
87 }