X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;ds=sidebyside;f=rhawk;h=0bc31a3ceadaf1512ed2ac9837a26ef77773f8b9;hb=HEAD;hp=5420d6363ab3dcf8c54ffa1da563a0d09ea4633c;hpb=aca48b707024eff702b87b3bf89ca6218f35ba16;p=~andy%2Frhawk diff --git a/rhawk b/rhawk index 5420d63..0bc31a3 100755 --- a/rhawk +++ b/rhawk @@ -3,7 +3,9 @@ @include "irc.awk" @include "json.awk" @include "spades.awk" -#@include "email.awk" +@include "email.awk" +@include "remind.awk" +@include "sfvlug.awk" # Initialization BEGIN { @@ -26,6 +28,8 @@ BEGIN { join("#rhspades") join("#sfvlug") } + + PROCINFO["sorted_in"] = "@ind_str_asc"; } # Admin @@ -97,53 +101,6 @@ CMD == "NICK" && FROM in bots { json_save("var/nocolor.json", nocolor); } -# SFV Lug -function email(to, from, subj, body, sendmail) -{ - from = NICK "" - subj = "Update sfvlug.org!" - body = "The next SFVLUG meeting is TBA!" - sendmail = "/usr/sbin/sendmail '" to "'" - print "To: " to | sendmail - print "From: " from | sendmail - print "Subject: " subj | sendmail - print "" | sendmail - print body | sendmail - say("Topic out of date, emailing " to); - close(sendmail) -} - -BEGIN { pollchan = "#sfvlug" } -(CMD == "PING" && systime()-lastpoll > 60*60*24) || -(CMD == "PRIVMSG" && /^\.poll/) { - if (!TOPICS[pollchan]) { - debug("Unknown topic for " pollchan); - send("TOPIC " pollchan) - next - } - _curl = "curl -s http://sfvlug.org/" - _day = "(Sun|Mon|Tue|Wed|Thu|Fri|Sat)" - _web_tba = "next meeting is: TBA" - _web_ptrn = "next meeting.*" _day "\\w+[, ]+([A-Z]\\w+) +([0-9]+)[, ]+([0-9]+)" - _irc_ptrn = _day "\\w*[, ]+([A-Z]\\w+) +([0-9]+)" - while (_curl | getline _line) { - #if (match(_line, _web_tba)) - # email("Brian "); - if (match(_line, _web_ptrn, _parts)) { - _date = _parts[1] " " _parts[2] " " _parts[3] - _topic = TOPICS[pollchan] - sub(_irc_ptrn, _date, _topic) - if (_topic != TOPICS[pollchan]) - topic(pollchan, TOPICS[pollchan] = _topic) - else - debug("topic is already correct") - break - } - } - lastpoll = systime() - close(_curl) -} - # Versin/Uptime function head(cmd, var) { cmd | getline var @@ -160,13 +117,15 @@ function uptime(time, fmt) { time / (1 ) % 60) } BEGIN { - up_version = head("git describe --always --dirty") + up_version = head("git describe --always") + up_dirty = head("git describe --always --dirty") up_author = head("git log -n1 --format=format:%an") up_message = head("git log -n1 --format=format:%s") up_reload = systime(); } /^\.(version|rev)/ { - say("version: " up_version " - " up_author " - " up_message) + say("version: " up_dirty " - " up_author " - " up_message) + say("http://pileus.org/git/?p=~andy/rhawk;h=" up_version) } /^\.uptime/ { _now = systime(); @@ -356,12 +315,6 @@ MSG !~ /^\./ && say("Awk, awk, awk! I'm a bird!") } -!(FROM in bots) && -((TO == NICK && /(help|halp)/) || - /^[^.](help|halp)/) { - reply("Nothing can help you now..") -} - /(\<[Hh][Oo]\>.*){3}/ { say("\00309Merry \00304Christmas!") } @@ -398,6 +351,14 @@ FROM == "rhnoise" && $2 == "slaps" && $3 == NICK { say("Springtime for Hitler and Germany!"); } +/^.drank mauchter/ { + if (!drank) { + system("sleep " 2) + say("\x02MD 20/20\x0f - \x02Morgen David\x0f - \x02Under an overpass\x0f - ***** (3 minutes ago)"); + } + drank=1 +} + # God damn commands FROM == "rhnoise" && load_mod { say(".load " load_mod) @@ -466,10 +427,29 @@ tolower($0) ~ /\/ { } # Vote relay -DST != "#rhnoise" && /\<[a-zA-Z0-9_]{3,16}(\+\+|--)/ { +DST != "#rhnoise" && DST != NICK && +/\<[a-zA-Z0-9_]{3,16}(\+\+|--)/ { say("#rhnoise", "(" DST ") " FROM ": " MSG); } +# Fun operators +function bang(a, b) { + if (a=="nan") return "nan"; + if (b=="nan") return "nan"; + if (a==b) return "nan"; + if (a==0) return "+0"; + if (b==0) return "-0"; + return 1/(1/a - 1/b); +} + +/^ *[+-]?[0-9]*\.?[0-9]+( *\? *[+-]?[0-9]*\.?[0-9]+)+ *$/ { + gsub(/?/, " "); + _num = $1+0; + for (_i=2; _i<=NF; _i++) + _num = bang(_num, $_i+0); + reply(_num); +} + # Misc { fflush("") }