diff --git a/Code/bash/cowtime.sh b/Code/bash/cowtime.sh new file mode 100755 index 0000000..0133957 --- /dev/null +++ b/Code/bash/cowtime.sh @@ -0,0 +1,6 @@ +file=$1 +cowtype=`/usr/games/cowsay -l | tail -n +2 | tr ' ' '\n' | sort -R | head -1` +beats=`echo "x = (\`date +%s\` + 3600) % 86400; scale=3; x / 86.4" | bc` + +echo '3 1' > $file +/usr/games/cowsay -W 24 -f $cowtype The time is @$beats >> $file diff --git a/Code/bash/disk_usage.sh b/Code/bash/disk_usage.sh new file mode 100755 index 0000000..c48ebc0 --- /dev/null +++ b/Code/bash/disk_usage.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +file=/home/krowbar/logs/du_log.json +date=`date +%s` +du_threshold=200 + +#prepare log file +if [ -a "$file" ] +then + echo "Appending to existing log file: $file" + head -n -1 $file > ${file}.swp #remove trailing "]" from last line + mv ${file}.swp ${file} + echo " ," >> $file +else + echo "Creating new log file: $file" + touch $file + echo "[" >> $file +fi + +#set up new object +echo " {" >> $file +echo " \"date\": $date," >> $file +echo " \"data\": [" >> $file + +add_comma=false +for user_dir in /home/* +do + + user="~${user_dir#/home/}" + disk_usage=`du -s $user_dir 2> /dev/null | cut -f 1` + file_count=`find $user_dir -type f 2> /dev/null | wc -l` + + if [ "$disk_usage" -gt "$du_threshold" ] + then + + if ${add_comma} + then + echo "," >> $file + else + add_comma=true + fi + echo -n " { \"user\": \"${user}\", \"du\": ${disk_usage}, \"files\": ${file_count} }" >> $file + fi +done + +echo -e "\n ]" >> $file #close new object data +echo " }" >> $file #close new object +echo "]" >> $file #close json array diff --git a/Code/bash/sanitize_quotes.sh b/Code/bash/sanitize_quotes.sh new file mode 100755 index 0000000..418d4c7 --- /dev/null +++ b/Code/bash/sanitize_quotes.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +quotesFile="/home/karlen/irc/quotes.txt" +outFile="/home/krowbar/scratch/quotes.txt" + +cat $quotesFile | grep -v '^[-/]' > $outFile diff --git a/Code/irc/acronymFinder.py b/Code/irc/acronymFinder.py index 9223586..ed2d16f 100644 --- a/Code/irc/acronymFinder.py +++ b/Code/irc/acronymFinder.py @@ -3,10 +3,10 @@ from bs4 import BeautifulSoup import random import string -dict = '/usr/share/dict/american-english-huge' +dict = '/usr/share/dict/american-english' (userId,token) = open("/home/krowbar/.secret/s4token").readline().rstrip().split(',') -def get_acros(word, silly): +def get_acros(word, silly, short): acros = [] url = "http://www.stands4.com/services/v2/abbr.php?uid=%s&tokenid=%s&term=%s" % (userId, token, word) soup = BeautifulSoup(urllib.urlopen(url).read(), 'html5lib') @@ -30,7 +30,10 @@ def get_acros(word, silly): for d in sorted(defs, key=lambda x:float(x['score']), reverse=True): #print d; - acros.append(("%s: \"%s\" (%s, score: %s)" % \ + if short is True: + acros.append("\"%s\"" % d['definition']) + else: + acros.append(("%s: \"%s\" (%s, score: %s)" % \ (d['term'], d['definition'], ', '.join(d['categories']), d['score'])\ ).encode('ascii', 'ignore')) if silly is True: @@ -44,10 +47,19 @@ def get_acros(word, silly): ).strip() print str(idx) + ' -> ' + newWord newDef.append(newWord) - acros.append(("%s: \"%s\" (%s, score: %s)" % \ - (word.upper(), string.capwords(' '.join(newDef)), 'Tilde.town Original', '0')\ + newWord = string.capwords(' '.join(newDef)) + if short is True: + acros.append("\"%s\"" % newWord) + else: + acros.append(("%s: \"%s\" (%s, score: %s)" % \ + (word.upper(), newWord, 'Tilde.town Original', '0')\ ).encode('ascii', 'ignore')) except IndexError: acros.append("Future hazy, try again later: Tilde.town Error"); - - return acros + if short is True: + shortList = acros[0:5] + if len(acros) > 5: + shortList.append(acros[-1]) + return [word.upper() + ': ' + ', '.join(shortList)] + else: + return acros diff --git a/Code/irc/banterbot.py b/Code/irc/banterbot.py index e32833d..0135d6b 100755 --- a/Code/irc/banterbot.py +++ b/Code/irc/banterbot.py @@ -199,7 +199,7 @@ def get_acronym(channel, text): if not text: ircsock.send("PRIVMSG " + channel + " :No text given :(\n") else: - defs = acronymFinder.get_acros(text, True) + defs = acronymFinder.get_acros(text, True, True) for d in defs[0:5]: #only the first five. they are already sorted by 'score' ircsock.send("PRIVMSG " + channel + " :" + d + "\n") if len(defs) > 5: @@ -256,7 +256,7 @@ def listen(): # print formatted split = formatted.split("\t") - time = split[0] + #time = split[0] user = split[1] command = split[2] channel = split[3] @@ -313,6 +313,7 @@ def listen(): ping() sys.stdout.flush() + time.sleep(1) ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connect(options.server, options.channel, options.nick) diff --git a/Code/irc/defineWord.py b/Code/irc/defineWord.py index 9adf8f2..1c78f9e 100644 --- a/Code/irc/defineWord.py +++ b/Code/irc/defineWord.py @@ -14,7 +14,7 @@ def define(word): key = open("/home/krowbar/.secret/key").readline().rstrip() -def defWord(word): +def defWord(word, short = True): defs = [] url = 'http://www.dictionaryapi.com/api/v1/references/collegiate/xml/%s?key=%s' % (word, key) soup = BeautifulSoup(urllib.urlopen(url).read(), 'html5lib') @@ -22,4 +22,7 @@ def defWord(word): if entry: for d in entry.find_all('dt'): defs.append(d.text.encode('ascii', 'ignore')) - return defs + if short: + return ' '.join(defs) + else: + return defs diff --git a/Code/irc/numberwangscores.txt b/Code/irc/numberwangscores.txt index a23ad2c..2ec3958 100644 --- a/Code/irc/numberwangscores.txt +++ b/Code/irc/numberwangscores.txt @@ -1,8 +1,12 @@ endorphant&^%68 -krowbar&^%175 +krowbar&^%221 karlen&^%2 jumblesal&^%37 marcus&^%28 premysl&^%29 demophoon&^%50 minerobbe&^%76 +bear&^%34 +cosnok&^%38 +caff&^%31 +amicabot&^%9 diff --git a/Code/irc/puzzle.py b/Code/irc/puzzle.py index 1453d67..d0c8231 100644 --- a/Code/irc/puzzle.py +++ b/Code/irc/puzzle.py @@ -1,19 +1,20 @@ #!/usr/bin/python import random import inflect +import quote_puzzle p = inflect.engine() primes = [11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71] -obfuscate = True -def make_puzzle(): +def make_puzzle(obfuscate=True): answer = 0 puzzle = random.choice(["Prove you're not a robot: ", "Are you a robot?: ", "Anti-bot check: ", "Counter-cndorphant measures: ", "Cosnok countermeasures: "]) puzzle += random.choice(["What is", "How many is", "What do you get from", "What do you get with", "What is the value of", "Can you answer", "Can you tell me"]) puzzle += " " - roll = random.randrange(0,6) + roll = random.randrange(0,10) var1 = random.randrange(1,10) var2 = random.randrange(1,10) + let1_ord = random.randrange(ord('a'), ord('z')+1) if roll == 0: answer = var1 + var2 @@ -36,13 +37,31 @@ def make_puzzle(): answer = var1 ** var2 puzzle += p.number_to_words(var1) + " to the " + p.ordinal(p.number_to_words(var2)) + " power" elif roll == 5: - p1 = primes[random.randrange(0,len(primes))] - p2 = primes[random.randrange(0,len(primes))] + p1 = random.choice(primes) + p2 = random.choice(primes) answer = str(min(p1,p2)) + ',' + str(max(p1,p2)) puzzle += p.number_to_words(p1 * p2) + " when factored into its two primes (answer in the form of the two primes with a comma between)" + elif roll == 6: + prime = random.choice(primes) + answer = prime % var1 + puzzle += p.number_to_words(prime) + " modulus " + p.number_to_words(var1) + elif roll == 7: + if let1_ord + var1 > ord('z'): + let1_ord -= var1 + answer = chr(let1_ord + var1) + puzzle = "What letter comes " + p.number_to_words(var1) + " letters after '" + chr(let1_ord) + "'" + obfuscate = False + elif roll == 8: + if let1_ord - var1 < ord('a'): + let1_ord += var1 + answer = chr(let1_ord - var1) + puzzle = "What letter comes " + p.number_to_words(var1) + " letters before '" + chr(let1_ord) + "'" + obfuscate = False + elif roll == 9: + answer, puzzle = quote_puzzle.get_quote() + obfuscate = False - - puzzle += "? (Answer with numbers)" + puzzle += "?" if obfuscate == True: for _ in range(3): idx = random.randrange(len(puzzle)-1) #get between 0 and string length diff --git a/Code/irc/quote_bot.py b/Code/irc/quote_bot.py index 21a4898..ca3af8c 100755 --- a/Code/irc/quote_bot.py +++ b/Code/irc/quote_bot.py @@ -112,6 +112,7 @@ def listen(): ping() sys.stdout.flush() + time.sleep(1) ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connect(options.server, options.channel, options.nick) diff --git a/Code/irc/randomtopics.txt b/Code/irc/randomtopics.txt index e375cdd..32003a8 100644 --- a/Code/irc/randomtopics.txt +++ b/Code/irc/randomtopics.txt @@ -976,3 +976,27 @@ Which is better: Harry Potter or Twilight? Which is the best season of the year? Is it better to date someone attractive and popular or intelligent and smart? Which is better to have as a pet: a cat or a dog? +Given the choice of anyone in the world, whom would you want as a dinner guest? +Would you like to be famous? In what way? +Before making a telephone call, do you ever rehearse what you are going to say? Why? +What would constitute a “perfect” day for you? +When did you last sing to yourself? To someone else? +If you were able to live to the age of 90 and retain either the mind or body of a 30-year-old for the last 60 years of your life, which would you want? +Name three things you and your partner appear to have in common. +For what in your life do you feel most grateful? +If you could change anything about the way you were raised, what would it be? +If you could wake up tomorrow having gained any one quality or ability, what would it be? +If a crystal ball could tell you the truth about yourself, your life, the future, or anything else, what would you want to know? +Is there something that you’ve dreamed of doing for a long time? Why haven’t you done it? +What is the greatest accomplishment of your life? +What do you value most in a friendship? +What is your most treasured memory? +What is your most terrible memory? +What does friendship mean to you? +What roles do love and affection play in your life? +How close and warm is your family? Do you feel your childhood was happier than most other people’s? +Complete this sentence:”I wish I had someone with whom I could share...” +If you were going to become a close friend with your partner, please share what would be important for him or her to know. +When did you last cry in front of another person? By yourself? +What, if anything, is too serious to be joked about? +Your house, containing everything you own, catches fire. After saving your loved ones and pets, you have time to safely make a final dash to save any one item. What would it be? Why? diff --git a/Code/irc/run_topic.sh b/Code/irc/run_topic.sh index 6b6ff44..94213ab 100755 --- a/Code/irc/run_topic.sh +++ b/Code/irc/run_topic.sh @@ -1,6 +1,6 @@ #!/bin/bash if [[ ! `pidof -sx topicbot.py` ]]; then - nohup ./topicbot.py -s 127.0.0.1 -n topicbot -c \#tildetown >> log 2>> log & + nohup ./topicbot.py -s 127.0.0.1 -n topicbot -c \#tildetown >> topiclog 2>> log & fi -#nohup ./topicbot.py -s 127.0.0.1 -n topicbot -c \#bot_test >> log 2>> log & +#nohup ./topicbot.py -s 127.0.0.1 -n topicbot -c \#bot_test >> topiclog 2>> log & #./topic_bot.py -s 127.0.0.1 -n topic_bot -c \#bot_test diff --git a/Code/irc/tildebot.py b/Code/irc/tildebot.py index 2caca58..c676804 100755 --- a/Code/irc/tildebot.py +++ b/Code/irc/tildebot.py @@ -53,12 +53,32 @@ def too_recent(time1, time2): else: return False +def get_positive(): + return random.choice(['Yes','Yep','Correct','You got it', 'Yeah', 'Right on', 'Uh-huh', 'Positive']) + +def get_negative(): + return random.choice(['No', 'Nope', 'Sorry', 'Wrong', 'Nuh-uh', 'Negatory', 'Incorrect', 'Not today', 'Try again', 'Maybe later']) + +def get_superlative(score): + if score > 4: + return random.choice(["super cool", "totally rad", "extraordinary", "dynomite", "#topdrawer", "a #TopLad", "the cat's meow", "a tilde town hero", "my favorite person", "incredibly lucky",\ + "unbelievable", "a tilde town hunk", "could bring all the boys to the yard", "worth twice their weight in gold"]); + elif score > 2: + return random.choice(["really cool", "pretty neat", "rather nice", "a dynamic doggo", "radical", "intense", "pretty lucky", "knows the territory", "has what it takes", "has mad skillz",\ + "going the distance"]); + else: + return random.choice(["cool", "nice", "acceptible", "good enough", "a promising pupper", "better than a horse", "swell", "a little lucky", "just credible", "my friend"]); + +def get_bad_thing(): + return random.choice(["is a meanie", "mugs me right off", "is worse than a horse", "smells like a ghost", "probably didn't bathe today", "didn't guess hard enough", "isn't lucky",\ + "smells of elderberries", "should reconsider their life choices", "did't believe in the heart of the tilde", "came to the wrong chat channel", "should have stopped while they were ahead",\ + "requires annotations from an authoratative source", "could have been a contender"]); + def get_prize(user, isHuman, bonus=0): prizes = [1] * 8 + [2] * 4 + [3] * 2 + [5] * isHuman #no 5pt prize for non-humans prize = random.choice(prizes) + bonus if(random.randint(1,10) > 6 - 4 * isHuman): #80% of the time it's a normal prize (40% for not humans) - return [prize, user + ": " + (random.choice(['Yes','Yep','Correct','You got it']) if isHuman else random.choice(['No', 'Nope', 'Sorry', 'Wrong']))\ - + "! You are " + ("super " if prize > 4 else "really " if prize > 2 else "") + "cool and get " + p.number_to_words(prize) + " tildes!"] + return [prize, user + ": " + (get_positive() if isHuman else get_negative()) + "! You are " + get_superlative(prize) + " and get " + p.number_to_words(prize) + " tildes!"] else: #20% of the time its a jackpot situation with open(JACKPOT_FILE, "r+") as jackpotfile: jackpot = int(jackpotfile.readline().strip("\n")) @@ -67,7 +87,7 @@ def get_prize(user, isHuman, bonus=0): if(random.randint(1,10) > 1 or not isHuman): #90% of the time it's a non-prize. non-humans never win jackpot new_jackpot = jackpot+max(1,prize) jackpotfile.write(str(new_jackpot)) #increase the jackpot by the prize size - return [0, user + " is a meanie and gets no tildes! (Jackpot is now " + str(new_jackpot) + " tildes)"] + return [0, user + " " + get_bad_thing() + " and gets no tildes! (Jackpot is now " + str(new_jackpot) + " tildes)"] else: #hit jackpot! jackpotfile.write(str(JACKPOT_MIN)) return [jackpot, user + " hit the jackpot and won **" + p.number_to_words(jackpot) + " tildes!**"] @@ -88,7 +108,7 @@ def give_tilde(channel, user, time, human, bonus=0): if(person[0] == user): found = True if(too_recent(time, person[2]) and not DEBUG): - ircsock.send("PRIVMSG " + channel + " :You have asked for a tilde too recently. Try again later.\n") + ircsock.send("PRIVMSG " + channel + " :" + user + " have asked for a tilde too recently and " + get_bad_thing() + ". Try again later.\n") else: prize = get_prize(user, human, bonus) score = person[0] + "&^%" + str(int(person[1]) + prize[0]) + "&^%" + time + "\n" @@ -123,7 +143,7 @@ def challenge_response(channel, user, time, msg): print(msg); if(challenges.has_key(user)): bonus = 1 if str(challenges[user]).find(',') != -1 else 0 #give a bonus for prime factoring - if(msg == str(challenges[user]) or msg == p.number_to_words(challenges[user])): + if(msg.lower() == str(challenges[user]).lower() or msg == p.number_to_words(challenges[user])): give_tilde(channel, user, time, True, bonus); else: give_tilde(channel, user, time, False, 0); diff --git a/Code/irc/tildescores.txt b/Code/irc/tildescores.txt index 546741b..bcba0c1 100644 --- a/Code/irc/tildescores.txt +++ b/Code/irc/tildescores.txt @@ -1,20 +1,20 @@ -krowbar&^%976&^%1473263667 +krowbar&^%1463&^%1490909046 karlen&^%277&^%1472020404 endorphant&^%682&^%1444775660 jumblesale&^%24&^%1426171214 -marcus&^%1684&^%1472578522 -papa&^%179&^%1438878499 +marcus&^%1941&^%1490895674 +papa&^%181&^%1474509971 epicmorphism&^%5&^%1421937744 audy&^%78&^%1466749239 -kc&^%18&^%1422326056 -vilmibm&^%9&^%1466847955 -cmr&^%1806&^%1473263713 +kc&^%28&^%1480730333 +vilmibm&^%13&^%1484794928 +cmr&^%2244&^%1485978592 imt&^%519&^%1424087616 cndorphant&^%788&^%1424094192 rain&^%17&^%1422310975 sl2c&^%91&^%1424847521 selfsame&^%1&^%1422230012 -bear&^%249&^%1469459728 +bear&^%414&^%1486058789 coaxial&^%8&^%1422325983 joe&^%8&^%1422325983 hardmath123&^%4&^%1422325983 @@ -27,8 +27,8 @@ cndorphbot&^%11&^%1441299746 reppard&^%11&^%1437512059 jesse&^%6&^%1437569027 khoi&^%3&^%1438044039 -sanqui&^%19&^%1472819894 -endorphan&^%101&^%1472425043 +sanqui&^%22&^%1474904633 +endorphan&^%107&^%1480548353 cndorphbo&^%9&^%1466591324 santi&^%3&^%1447873216 insom&^%1&^%1450346059 @@ -39,6 +39,18 @@ synergian&^%22&^%1458152889 dheeraj&^%5&^%1456489270 demobot&^%6&^%1454439605 premysl&^%65&^%1461768606 -minerobbe&^%23&^%1465950289 +minerobbe&^%30&^%1485835028 xkeeper&^%14&^%1461967961 -cosnok&^%385&^%1473263717 +cosnok&^%806&^%1488947964 +escobar&^%1&^%1475431401 +amicabot&^%30&^%1481225205 +caff&^%477&^%1490733646 +kadin&^%5&^%1479870008 +desvox&^%5&^%1481632697 +mankins&^%3&^%1480211581 +cinch&^%2&^%1480454755 +caffbot&^%533&^%1490733657 +evilbot&^%4&^%1480693919 +tybaltcat&^%7&^%1481076625 +minerbot&^%3&^%1485835065 +mio&^%4&^%1489082484 diff --git a/Code/irc/topicbot.py b/Code/irc/topicbot.py index 084e916..dd828ee 100755 --- a/Code/irc/topicbot.py +++ b/Code/irc/topicbot.py @@ -8,6 +8,7 @@ import sys from optparse import OptionParser import fileinput import random +import time import formatter import get_users @@ -152,20 +153,20 @@ def listen(): # print formatted split = formatted.split("\t") - time = split[0] + msgtime = split[0] user = split[1] command = split[2] channel = split[3] messageText = split[4] if(command == "TOPIC" and user != options.nick): - count_topic(channel,user, time, messageText) + count_topic(channel,user, msgtime, messageText) if ircmsg.find(":!topic") != -1: - get_topic(channel, user, time) + get_topic(channel, user, msgtime) if ircmsg.find(":!settopic") != -1: - set_topic(channel, user, time, messageText[10:]) + set_topic(channel, user, msgtime, messageText[10:]) if ircmsg.find(":!tscores") != -1: topic_scores(channel) @@ -173,9 +174,9 @@ def listen(): topic_score(channel) if ircmsg.find(":!randomtopic") != -1: - random_topic(channel, user, time, True) + random_topic(channel, user, msgtime, True) if ircmsg.find(":!suggesttopic") != -1: - random_topic(channel,user,time, False) + random_topic(channel,user,msgtime, False) if ircmsg.find(":!thistory") != -1: topic_history(channel, user, messageText) @@ -187,6 +188,7 @@ def listen(): ping() sys.stdout.flush() + time.sleep(1) ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connect(options.server, options.channel, options.nick) diff --git a/Code/irc/topics_#bots.txt b/Code/irc/topics_#bots.txt index dd9d346..d6120ac 100644 --- a/Code/irc/topics_#bots.txt +++ b/Code/irc/topics_#bots.txt @@ -27,3 +27,7 @@ 1470840451&^%marcus&^%Bots are cool, yo! 1471364647&^%krowbar&^%Test bots and play games 1471365078&^%krowbar&^%Test bots and play games. Use !rollcall to list bot's abilities +1475761505&^%krowbar&^%Test bots and play with them +1475761589&^%krowbar&^%Test bots and play games. Use !rollcall to list bot's abilities +1475761599&^%krowbar&^%Test bots and play games. Use !rollcall to list bot's abilities +1475765914&^%cmr&^%Test bots and play games. Use !rollcall to list bots' abilities diff --git a/Code/irc/topics_#tildetown.txt b/Code/irc/topics_#tildetown.txt index 73ba209..2a8cd43 100644 --- a/Code/irc/topics_#tildetown.txt +++ b/Code/irc/topics_#tildetown.txt @@ -159,3 +159,29 @@ 1471364822&^%krowbar&^%If you could be permanently one color for the rest of your life, what color would it be & why? 1472981491&^%vilmibm&^%any feedback on the new homepage template? http://tilde.town/~vilmibm/new_tilde_index.html 1473143684&^%vilmibm&^%how was your day? +1473493478&^%vilmibm&^%when was the last time you smiled +1474433676&^%vilmibm&^%you stub your toe. what's the first thing you think about? +1474741818&^%vilmibm&^%emacs updated to 25.2 | tweepy installed for python 2 & 3 | how are the feels today? +1474741976&^%vilmibm&^%REBOOT SCHEDULED for night of Sunday 9/25 | prep for apocalypse | emacs fixed +1474867066&^%vilmibm&^%THE END IS NIGH | PLEASE RECONNECT +1474907143&^%vilmibm&^%thank you for your reconnection +1475735477&^%vilmibm&^%was today better than yesterday? or the same? or? +1476135782&^%vilmibm&^%contribute to the zine <3 https://github.com/tildetown/zine +1476138398&^%vilmibm&^%tilde.town turns two tomorrow! | alliteration appreciated +1476209319&^%vilmibm&^%HAPPY BIRTHDAY!!!!! +1476382999&^%vilmibm&^%we're two years old! contribute to zine issue 2! https://github.com/tildetown/zine/tree/master/issue%202 +1478737007&^%vilmibm&^%contribute to the second issue of the zine! https://github.com/tildetown/zine/blob/master/contributing.md +1479517668&^%vilmibm&^%wHaT...tha WoOf! | contribute 2 zine: https://github.com/tildetown/zine/blob/master/contributing.md +1479931451&^%vilmibm&^%/join #music | zine vol 2! https://github.com/tildetown/zine/blob/master/contributing.md +1480058791&^%vilmibm&^%畂桳栠摩琠敨映捡獴 | /join #music | contrib 2 zine http://bit.ly/2gslcg3 +1480139365&^%vilmibm&^%RIP castro | 畂桳栠摩琠敨映捡獴 | /join #music | contrib 2 zine http://bit.ly/2gslcg3 +1480140856&^%vilmibm&^%RIP castro | /join #music | contrib 2 zine http://bit.ly/2gslcg3 +1480489447&^%vilmibm&^%they call me DJ colspan | /join #music | contrib 2 zine http://bit.ly/2gslcg3 +1482644786&^%vilmibm&^%happy xmas if yr into it | contrib 2 zine https://github.com/tildetown/zine +1483206856&^%vilmibm&^%happy new 365th kilobeat! | contrib 2 zine https://github.com/tildetown/zine +1484692523&^%vilmibm&^%hooray for chelsea manning <3 | contrib2zine https://github.com/tildetown/zine +1484724998&^%vilmibm&^%hooray for chelsea manning! <3 | join our starbound server! starbound.tilde.town | contrib2zine https://github.com/tildetown/zine +1486083879&^%vilmibm&^%the town is lovely / its people are nice | checkout #starbound | contrib 2 zine https://github.com/tildetown/zine/tree/master/issue_2 +1487317602&^%vilmibm&^%what would you change about the town? | checkout #starbound | contrib 2 zine https://github.com/tildetown/zine/tree/master/issue_2 +1488837030&^%vilmibm&^%what made you feel good today? | checkout #starbound | contrib 2 zine https://github.com/tildetown/zine/tree/master/issue_2 +1490764617&^%vilmibm&^%let's make some stuff | check out #starbound, #dev | zine! https://github.com/tildetown/zine/tree/master/issue_2 diff --git a/Code/irc/topicscores.txt b/Code/irc/topicscores.txt index fa96135..d8536f9 100644 --- a/Code/irc/topicscores.txt +++ b/Code/irc/topicscores.txt @@ -1,9 +1,11 @@ -krowbar&^%15&^%26 -vilmibm&^%0&^%44 +krowbar&^%17&^%29 +vilmibm&^%0&^%70 hardmath123&^%0&^%6 joe&^%1&^%1jumblesale audiodude&^%1&^%0 -cmr&^%0&^%5 +cmr&^%0&^%6 insom&^%1&^%0 premysl&^%0&^%1marcus&^%1&^%0 marcus&^%1&^%1 +papa&^%1&^%0 +desvox&^%1&^%0 diff --git a/Code/irc/wangbot.py b/Code/irc/wangbot.py index 09f13be..7ec0bfa 100755 --- a/Code/irc/wangbot.py +++ b/Code/irc/wangbot.py @@ -258,6 +258,7 @@ def listen(): ping() sys.stdout.flush() + time.sleep(1) ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connect(options.server, options.channel, options.nick) diff --git a/Code/python/chatcloud.py b/Code/python/chatcloud.py index 25b75a7..5c3f71c 100755 --- a/Code/python/chatcloud.py +++ b/Code/python/chatcloud.py @@ -8,15 +8,17 @@ import shutil logfile = "/home/jumblesale/Code/irc/log" outfile = "/home/krowbar/logs/chatcloud.json" -#outfile = "/home/krowbar/logs/chatcloud_2016_01.json" +#outfile = "/home/krowbar/logs/chatcloud_2016_10.json" + bannedUsersFile = "/home/krowbar/Code/python/bannedUsers" bannedWordsFile = "/home/krowbar/Code/python/bannedWords" wordData = {} # keyed by "word" that contains a count #we only care about recent chats, let's say for the past sixteen hours timeTo = calendar.timegm(time.gmtime()) -#timeTo = calendar.timegm(time.strptime("1 Feb 16", "%d %b %y")) +#timeTo = calendar.timegm(time.strptime("1 Nov 16", "%d %b %y")) + timeCutoff = timeTo - (16 * 60 * 60) -#timeCutoff = calendar.timegm(time.strptime("1 Jan 16", "%d %b %y")) +#timeCutoff = calendar.timegm(time.strptime("1 Oct 16", "%d %b %y")) print "Generating word cloud based off words from " + str(timeCutoff) + " to " + str(timeTo) minOccurance = 3 #we'll have to reduce the minOccurances if we reduce the timeCutoff minLength = 3 #number of letters long diff --git a/Code/python/chatstats.py b/Code/python/chatstats.py index e7553cd..30784ad 100644 --- a/Code/python/chatstats.py +++ b/Code/python/chatstats.py @@ -4,10 +4,15 @@ import json import time import calendar import shutil +import re logfile = "/home/jumblesale/Code/irc/log" outfile = "/home/krowbar/logs/chatStats.json" userData = {} #hash keyed by "user" that contains a start timestamp, last timestamp, last said string, chat count, letter count, and word count + #also now happy emotes and sad emotes +rejectRegexp = "http[s]?://|[0-9]{2}[;:][0-9]{2}" +happyRegexp = ":[-]?[])}]" +sadRegexp = ":[-]?[[({]" nameFix = { 'jumblesal': 'jumblesale', 'hardmath1': 'kc', @@ -68,10 +73,17 @@ with open(logfile, "r") as log: userData[user]['lastMention'] = 0 userData[user]['responseTime'] = 0 userData[user]['botUse'] = 0 + userData[user]['happyEmotes'] = 0 + userData[user]['sadEmotes'] = 0 lastUser = user; if message.rstrip() and message[0] == '!': userData[user]['botUse'] += 1 + if not re.search(rejectRegexp, message): + if re.search(happyRegexp, message): + userData[user]['happyEmotes'] += 1 + if re.search(sadRegexp, message): + userData[user]['sadEmotes'] += 1 try: if message.rstrip() and message.split()[0][-1] == ':': #last character of first word diff --git a/public_html/chatcloud/index.html b/public_html/chatcloud/index.html index 5292953..b185598 100644 --- a/public_html/chatcloud/index.html +++ b/public_html/chatcloud/index.html @@ -4,6 +4,15 @@