From 94127052c9680c6e8138b01d21c33a45d15b80b4 Mon Sep 17 00:00:00 2001 From: Russell Date: Tue, 13 Oct 2015 08:23:17 -0500 Subject: [PATCH] Periodic git commit --- Code/irc/numberwangscores.txt | 2 + Code/irc/run_wang.sh | 2 +- Code/irc/tildescores.txt | 14 +++---- Code/irc/topics_#bots.txt | 3 ++ Code/irc/topics_#tildetown.txt | 10 +++++ Code/irc/topicscores.txt | 8 ++-- Code/irc/wangbot.py | 2 +- Code/python/bannedWords | 31 ++++++++++++++ Code/python/chatchecker.py | 10 ++++- Code/python/chatcloud.py | 23 +++++++--- public_html/chatChecker/cc.html | 21 ---------- public_html/chatChecker/todo | 26 ------------ public_html/chatcloud/index.html | 70 +++++++++++++++++++++++++++---- public_html/index.html | 18 +++++--- public_html/mission/js/mission.js | 14 ++++--- 15 files changed, 169 insertions(+), 85 deletions(-) mode change 100644 => 100755 Code/python/chatcloud.py delete mode 100644 public_html/chatChecker/cc.html delete mode 100644 public_html/chatChecker/todo diff --git a/Code/irc/numberwangscores.txt b/Code/irc/numberwangscores.txt index e69de29..854825f 100644 --- a/Code/irc/numberwangscores.txt +++ b/Code/irc/numberwangscores.txt @@ -0,0 +1,2 @@ +endorphant&^%68 +krowbar&^%60 diff --git a/Code/irc/run_wang.sh b/Code/irc/run_wang.sh index 3a6ef54..ccc8658 100755 --- a/Code/irc/run_wang.sh +++ b/Code/irc/run_wang.sh @@ -1,4 +1,4 @@ #!/bin/bash -nohup ./wangbot.py -s 127.0.0.1 -n numberwang_bot -c \#tildetown >> wanglog 2>> wanglog & +nohup ./wangbot.py -s 127.0.0.1 -n numberwang_bot -c \#bots >> wanglog 2>> wanglog & #nohup ./wangbot.py -s 127.0.0.1 -n numberwang_bot -c \#bot_test >> wanglog 2>> wanglog & diff --git a/Code/irc/tildescores.txt b/Code/irc/tildescores.txt index b476a68..7f5b06f 100644 --- a/Code/irc/tildescores.txt +++ b/Code/irc/tildescores.txt @@ -1,20 +1,20 @@ -krowbar&^%225&^%1438182841 +krowbar&^%238&^%1444399178 karlen&^%271&^%1426779321 -endorphant&^%630&^%1438131263 +endorphant&^%676&^%1444741627 jumblesale&^%24&^%1426171214 -marcus&^%616&^%1440424356 +marcus&^%787&^%1444392035 papa&^%179&^%1438878499 epicmorphism&^%5&^%1421937744 -audy&^%76&^%1431897326 +audy&^%78&^%1442345315 kc&^%18&^%1422326056 vilmibm&^%9&^%1423247508 -cmr&^%864&^%1440424361 +cmr&^%1006&^%1444701265 imt&^%519&^%1424087616 cndorphant&^%788&^%1424094192 rain&^%17&^%1422310975 sl2c&^%91&^%1424847521 selfsame&^%1&^%1422230012 -bear&^%208&^%1438015446 +bear&^%213&^%1443668443 coaxial&^%8&^%1422325983 joe&^%8&^%1422325983 hardmath123&^%4&^%1422325983 @@ -23,7 +23,7 @@ cel&^%11&^%1430162676 quote_bots&^%3&^%1424737471 bave&^%1&^%1427591141 scellef&^%13&^%1428707074 -cndorphbot&^%8&^%1438044694 +cndorphbot&^%11&^%1441299746 reppard&^%11&^%1437512059 jesse&^%6&^%1437569027 khoi&^%3&^%1438044039 diff --git a/Code/irc/topics_#bots.txt b/Code/irc/topics_#bots.txt index 75d3739..2120167 100644 --- a/Code/irc/topics_#bots.txt +++ b/Code/irc/topics_#bots.txt @@ -13,3 +13,6 @@ 1426455418&^%endorphant&^%http://tilde.town/~wiki/ircbots.html | !golem 1429088209&^%jumblesale&^% 1429628571&^%endorphant&^%http://tilde.town/~wiki/ircbots.html +1443998388&^%cmr&^%http://tilde.town/~wiki/ircbots.html +1443998393&^%cmr&^%http://tilde.town/~wiki/ircbots.html +1444203916&^%cmr&^%http://tilde.town/~wiki/ircbots.html | cndorphbot: diff --git a/Code/irc/topics_#tildetown.txt b/Code/irc/topics_#tildetown.txt index c362e30..8c70019 100644 --- a/Code/irc/topics_#tildetown.txt +++ b/Code/irc/topics_#tildetown.txt @@ -108,3 +108,13 @@ 1439443352&^%vilmibm&^%let's talk bout html and feels | congrats ~joe 1440076665&^%krowbar&^%Let's Play Factorio together! Community event *this* Saturday 1pm-3pm GMT. Ask ~krowbar or ~jumblesale for details 1440363401&^%krowbar&^%Welcome to tilde.town! A place where creativity abounds! +1440688887&^%krowbar&^%Welcome to tilde.town! Visit tilde.town/~krowbar/chatcloud to visualize the last 12 hours. +1440766704&^%krowbar&^%Tilde.town internet game social event. Indicate your availability at this poll: http://doodle.com/7q2dd74nfm2aqwcf +1442236331&^%krowbar&^%If you could take back something hurtful you've once said to someone, what would it be? +1442243124&^%krowbar&^%Is the milk glass half full or half empty and why? +1442243139&^%krowbar&^%What do you think the most ultimate gift of the world is. +1442255293&^%vilmibm&^%let's talk about html and feels +1442257397&^%vilmibm&^%what should we do for tilde.town's birthday?? | tilde.town turns 1 on October 11th +1442498441&^%krowbar&^%YAR! Happy Talk Like A Pirate Day on this fine September the 17th! Avast, ye scallywags! +1442502425&^%krowbar&^%what should we do for tilde.town's birthday?? | tilde.town turns 1 on October 11th +1444587668&^%vilmibm&^%~~~~~~~~~~~~HAPPY BIRTHDAY~~~~~~~~~~ diff --git a/Code/irc/topicscores.txt b/Code/irc/topicscores.txt index c519564..a379b3a 100644 --- a/Code/irc/topicscores.txt +++ b/Code/irc/topicscores.txt @@ -1,4 +1,6 @@ -krowbar&^%0&^%6 -vilmibm&^%0&^%6 +krowbar&^%0&^%13 +vilmibm&^%0&^%9 hardmath123&^%0&^%6 -joe&^%0&^%1 \ No newline at end of file +joe&^%0&^%1jumblesale&^%1&^%0 +audiodude&^%1&^%0 +cmr&^%0&^%3 diff --git a/Code/irc/wangbot.py b/Code/irc/wangbot.py index 0b89bbb..4f403ba 100755 --- a/Code/irc/wangbot.py +++ b/Code/irc/wangbot.py @@ -164,7 +164,7 @@ def save_scores(): score = line.strip("\n").split("&^%") if(score[0] == name): line = score[0] + "&^%" + str(int(score[1]) + currentScores[name]) + "\n" - currentScores.remove(name) + del currentScores[name] break scorefile.write(line) diff --git a/Code/python/bannedWords b/Code/python/bannedWords index db3dbbb..c2c89a2 100644 --- a/Code/python/bannedWords +++ b/Code/python/bannedWords @@ -197,3 +197,34 @@ there doing even does +theres +theyve +were +using +could +should +wont +way +though +being +while +cant +only +well +very +didnt +hes +quite +havent +weant +might +say +mean +still +come +will +used +want +roll +dice +length diff --git a/Code/python/chatchecker.py b/Code/python/chatchecker.py index 79da317..79c9693 100644 --- a/Code/python/chatchecker.py +++ b/Code/python/chatchecker.py @@ -8,8 +8,10 @@ import shutil logfile = "/home/jumblesale/Code/irc/log" outfile = "/home/krowbar/logs/userData.json" userData = {} #hash keyed by "user" that contains an array of timestamps -#we only care about recent chats, let's say for the past two weeks -timeCutoff = calendar.timegm(time.gmtime()) - (2 * 7 * 24 * 60 * 60) +#we only care about recent chats, let's say for the past couple weeks +oneWeek = 7 * 24 * 60 * 60 +fiveMinutes = 5 * 60 +timeCutoff = calendar.timegm(time.gmtime()) - (2 * oneWeek) with open(logfile, "r") as log: for line in log: @@ -19,8 +21,12 @@ with open(logfile, "r") as log: except ValueError: continue #There are some bad lines in the log file that we'll ignore if we can't parse if time > timeCutoff: + #standardize all times into a single "week" + #time %= oneWeek #if the user already exists in the list if user in userData: + if time < userData[user][-1] + fiveMinutes: + continue #only record times that are at least five minutes apart userData[user].append(time) #append the new time else: #if they are new userData[user] = [time] #create a new list diff --git a/Code/python/chatcloud.py b/Code/python/chatcloud.py old mode 100644 new mode 100755 index de62298..afdb4ed --- a/Code/python/chatcloud.py +++ b/Code/python/chatcloud.py @@ -8,12 +8,17 @@ import shutil logfile = "/home/jumblesale/Code/irc/log" outfile = "/home/krowbar/logs/chatcloud.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 two weeks -timeCutoff = calendar.timegm(time.gmtime()) - (2 * 7 * 24 * 60 * 60) -minOccurance = 10 +#we only care about recent chats, let's say for the past sixteen hours +timeTo = calendar.timegm(time.gmtime()) +timeCutoff = timeTo - (16 * 60 * 60) +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 bannedWords = open(bannedWordsFile).read().splitlines() +bannedUsers = open(bannedUsersFile).read().splitlines() with open(logfile, "r") as log: for line in log: @@ -22,9 +27,13 @@ with open(logfile, "r") as log: time = int(time) except ValueError: continue #There are some bad lines in the log file that we'll ignore if we can't parse - if time > timeCutoff: - for word in re.sub('[\'\";:,.?!*&^\-()\[\]]', '', message).lower().split(): - if word in bannedWords: + if user in bannedUsers: + continue #We don't care what they say + if time >= timeCutoff and time <= timeTo: + #print "Processing line from " + user + " at " + str(time) + for word in re.sub('[\'\"\`\/\\;:,.?!*&^\-()<>|_\[\]0-9]', '', message).lower().split(): + if len(word) < minLength or word in bannedWords: + #print "Rejecting " + word continue #if the word already exists in the list if word in wordData: @@ -33,6 +42,8 @@ with open(logfile, "r") as log: wordData[word] = 1 #print "Added word: " + word wordData = {i:wordData[i] for i in wordData if wordData[i] >= minOccurance } +if(len(wordData) == 0): + wordData = {"NOTHING": 1, "INTERESTING": 1, "TODAY": 1} with open(outfile + ".tmp", "w") as tmpFile: tmpFile.write(json.dumps(wordData)) shutil.move(outfile + ".tmp", outfile) diff --git a/public_html/chatChecker/cc.html b/public_html/chatChecker/cc.html deleted file mode 100644 index 7e9b7f9..0000000 --- a/public_html/chatChecker/cc.html +++ /dev/null @@ -1,21 +0,0 @@ - - - -Who chats and when? - - - - - - - -Here's some stuff! Check the console for userData -
-Maybe I should use Google charts again instead of D3. Remember to use .setUTCSeconds() - - diff --git a/public_html/chatChecker/todo b/public_html/chatChecker/todo deleted file mode 100644 index f6892bf..0000000 --- a/public_html/chatChecker/todo +++ /dev/null @@ -1,26 +0,0 @@ - -How do do stuff - -Data structure -users["name"] - .talked = array of irc times - .mentioned = array of irc times - - -DATA DAEMON -* Parse log for nicks that said something - - Populate data structure -* For each line, log the person who talked - - Check if any other person was mentioned - - Only log if it is at least 1 minute past their last chat/reference (maybe - to reduce data size) -* Write to log file - - Same file or dated one? - - Only certain time frames?? -* Run daily/hourly? - -PRESENTATION -* Select a user name from the drop down - - See a timeline with colored strands of when they spoke and were mentioned -* Something that looks like the Github commit history -* Use D3 for coolness diff --git a/public_html/chatcloud/index.html b/public_html/chatcloud/index.html index ef9a117..64df28f 100644 --- a/public_html/chatcloud/index.html +++ b/public_html/chatcloud/index.html @@ -1,6 +1,35 @@ +
+ + + +
+
@@ -8,30 +37,54 @@ + diff --git a/public_html/index.html b/public_html/index.html index e3c9fc3..74db0cc 100644 --- a/public_html/index.html +++ b/public_html/index.html @@ -1,14 +1,22 @@ -WIP +~krowbar's home page -

I just clobbered my index.html file

-

New site some time soon

+Links and stuff + +

Tilde.town IRC Chat cloud

+ + +

Mission name generator

+ + +

Tilde.town disk usage

+ diff --git a/public_html/mission/js/mission.js b/public_html/mission/js/mission.js index b487b45..eda06c6 100644 --- a/public_html/mission/js/mission.js +++ b/public_html/mission/js/mission.js @@ -7,20 +7,24 @@ var self = this; -var adjectives = Array('Bold','Breaking','Brilliant','Crescent','Dark|Darkness','Desert|Desert','Evening|Darkness','Final','First','July','Last','Libery|Liberty','Magic|Magic','Morning|Morning','Power|Power','Phantom','Present','Roaring|Roar|Scream','Rolling','Sand','Screaming','Soaring','Standing|Stand','Star|Star','Urgent','Utopian','Valiant'); -var nouns = Array('Action','Alert','Beauty','Claw','Darkness','Dawn','Day','Desert','Envy','Fall','Fist','Flight','Fury','Guard','Hammer','Hand','Honor','Hope','Hurricane','Liberty','Light','Lightning','Magic','Morning','October','Power','Rain','Repose','Roar','Scream','Skull','Shield','Stand','Star','Storm','Streak','Sun','Thunder','Wind','Wrath'); -var colors = Array('Black','Blue','Brown','Gray','Green','Indego','Orange','Purple','Rainbow','Red','Scarlet','Violet','White','Yellow'); -var actors = Array('Condor','Eagle','Guardian','Hawk','Hydra','Lady','Lion','Scorpion','Spartan','Titan','Victor','Viking','Warrior'); +var adjectives = Array('Bold','Breaking','Brilliant','Crescent','Dark|Darkness','Desert|Desert','Eternal','Evening|Darkness','Final','First','Forever','Glorious','Joyful','July','Last','Libery|Liberty','Magic|Magic','Morning|Morning','Power|Power','Phantom','Present','Roaring|Roar|Scream','Rolling','Sand','Screaming|Roar|Scream','Soaring','Standing|Stand','Star|Star','Twisted','Urgent','Utopian','Valiant'); +var nouns = Array('Action','Alert','Beauty','Claw','Darkness','Dawn','Day','Desert','Envy','Fall','Fist','Flight','Fury','Guard','Hammer','Hand','Honor','Hope','Hurricane','Liberty','Light','Lightning','Magic','Morning','October','Power','Rain','Repose','Roar','Scream','Skull','Sky','Skies','Shield','Stand','Star','Storm','Streak','Strike','Sun','Thunder','Victory','Whisper','Wind','Wrath'); +var colors = Array('Black','Blue','Brown','Gray','Green','Indego','Orange','Purple','Rainbow','Red','Scarlet','Silver','Violet','White','Yellow'); +var actors = Array('Cobra','Condor','Dragon','Eagle','Guardian','Hawk','Hydra','Jackal','King','Knight','Lady','Lion','Scorpion','Spartan','Titan','Victor','Viking','Warrior'); var mission_grammars = Array( {chance:30, grammar: 'adj1 + " " + noun1'}, + {chance:20, grammar: 'adj1 + " " + actor'}, {chance:10, grammar: 'color + " " + noun1'}, {chance:10, grammar: 'color + " " + actor'}, {chance:10, grammar: 'actor +"\'s " + noun1'}, {chance:10, grammar: 'noun1 + " of the " + noun2'}, + {chance:10, grammar: 'noun1 + " of the " + actor'}, + {chance:10, grammar: 'actor + " of the " + noun1'}, {chance:10, grammar: 'noun1 + " of " + noun2'}, {chance:10, grammar: 'noun1 + " of " + color + " " + noun2'}, {chance:10, grammar: 'adj1 + " " + noun1 + " and " + adj2 + " " + noun2'}, - {chance:3, grammar: '"Attack of the " + actor + "s"'} + {chance:3, grammar: '"Attack of the " + actor + "s"'}, + {chance:3, grammar: '"Return of the " + actor + "s"'} ); this.getNoun = function(badNouns) { return _.chain(nouns)