Periodic git commit

This commit is contained in:
RussellChamp committed 2015-10-13 08:23:17 -05:00
1 parent 0b5a4fcfb8
commit 94127052c9
15 files changed
+168 -84

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
endorphant&^%68
krowbar&^%60
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/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 & #nohup ./wangbot.py -s 127.0.0.1 -n numberwang_bot -c \#bot_test >> wanglog 2>> wanglog &
+7 -7
View File
@@ -1,20 +1,20 @@
krowbar&^%225&^%1438182841 krowbar&^%238&^%1444399178
karlen&^%271&^%1426779321 karlen&^%271&^%1426779321
endorphant&^%630&^%1438131263 endorphant&^%676&^%1444741627
jumblesale&^%24&^%1426171214 jumblesale&^%24&^%1426171214
marcus&^%616&^%1440424356 marcus&^%787&^%1444392035
papa&^%179&^%1438878499 papa&^%179&^%1438878499
epicmorphism&^%5&^%1421937744 epicmorphism&^%5&^%1421937744
audy&^%76&^%1431897326 audy&^%78&^%1442345315
kc&^%18&^%1422326056 kc&^%18&^%1422326056
vilmibm&^%9&^%1423247508 vilmibm&^%9&^%1423247508
cmr&^%864&^%1440424361 cmr&^%1006&^%1444701265
imt&^%519&^%1424087616 imt&^%519&^%1424087616
cndorphant&^%788&^%1424094192 cndorphant&^%788&^%1424094192
rain&^%17&^%1422310975 rain&^%17&^%1422310975
sl2c&^%91&^%1424847521 sl2c&^%91&^%1424847521
selfsame&^%1&^%1422230012 selfsame&^%1&^%1422230012
bear&^%208&^%1438015446 bear&^%213&^%1443668443
coaxial&^%8&^%1422325983 coaxial&^%8&^%1422325983
joe&^%8&^%1422325983 joe&^%8&^%1422325983
hardmath123&^%4&^%1422325983 hardmath123&^%4&^%1422325983
@@ -23,7 +23,7 @@ cel&^%11&^%1430162676
quote_bots&^%3&^%1424737471 quote_bots&^%3&^%1424737471
bave&^%1&^%1427591141 bave&^%1&^%1427591141
scellef&^%13&^%1428707074 scellef&^%13&^%1428707074
cndorphbot&^%8&^%1438044694 cndorphbot&^%11&^%1441299746
reppard&^%11&^%1437512059 reppard&^%11&^%1437512059
jesse&^%6&^%1437569027 jesse&^%6&^%1437569027
khoi&^%3&^%1438044039 khoi&^%3&^%1438044039
+3
View File
@@ -13,3 +13,6 @@
1426455418&^%endorphant&^%http://tilde.town/~wiki/ircbots.html | !golem 1426455418&^%endorphant&^%http://tilde.town/~wiki/ircbots.html | !golem
1429088209&^%jumblesale&^% 1429088209&^%jumblesale&^%
1429628571&^%endorphant&^%http://tilde.town/~wiki/ircbots.html 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:
+10
View File
@@ -108,3 +108,13 @@
1439443352&^%vilmibm&^%let's talk bout html and feels | congrats ~joe 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 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! 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~~~~~~~~~~
+5 -3
View File
@@ -1,4 +1,6 @@
krowbar&^%0&^%6 krowbar&^%0&^%13
vilmibm&^%0&^%6 vilmibm&^%0&^%9
hardmath123&^%0&^%6 hardmath123&^%0&^%6
joe&^%0&^%1 joe&^%0&^%1jumblesale&^%1&^%0
audiodude&^%1&^%0
cmr&^%0&^%3
+1 -1
View File
@@ -164,7 +164,7 @@ def save_scores():
score = line.strip("\n").split("&^%") score = line.strip("\n").split("&^%")
if(score[0] == name): if(score[0] == name):
line = score[0] + "&^%" + str(int(score[1]) + currentScores[name]) + "\n" line = score[0] + "&^%" + str(int(score[1]) + currentScores[name]) + "\n"
currentScores.remove(name) del currentScores[name]
break break
scorefile.write(line) scorefile.write(line)
+31
View File
@@ -197,3 +197,34 @@ there
doing doing
even even
does 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
+8 -2
View File
@@ -8,8 +8,10 @@ import shutil
logfile = "/home/jumblesale/Code/irc/log" logfile = "/home/jumblesale/Code/irc/log"
outfile = "/home/krowbar/logs/userData.json" outfile = "/home/krowbar/logs/userData.json"
userData = {} #hash keyed by "user" that contains an array of timestamps 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 #we only care about recent chats, let's say for the past couple weeks
timeCutoff = calendar.timegm(time.gmtime()) - (2 * 7 * 24 * 60 * 60) oneWeek = 7 * 24 * 60 * 60
fiveMinutes = 5 * 60
timeCutoff = calendar.timegm(time.gmtime()) - (2 * oneWeek)
with open(logfile, "r") as log: with open(logfile, "r") as log:
for line in log: for line in log:
@@ -19,8 +21,12 @@ with open(logfile, "r") as log:
except ValueError: except ValueError:
continue #There are some bad lines in the log file that we'll ignore if we can't parse continue #There are some bad lines in the log file that we'll ignore if we can't parse
if time > timeCutoff: if time > timeCutoff:
#standardize all times into a single "week"
#time %= oneWeek
#if the user already exists in the list #if the user already exists in the list
if user in userData: 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 userData[user].append(time) #append the new time
else: #if they are new else: #if they are new
userData[user] = [time] #create a new list userData[user] = [time] #create a new list
Regular → Executable
+17 -6
View File
@@ -8,12 +8,17 @@ import shutil
logfile = "/home/jumblesale/Code/irc/log" logfile = "/home/jumblesale/Code/irc/log"
outfile = "/home/krowbar/logs/chatcloud.json" outfile = "/home/krowbar/logs/chatcloud.json"
bannedUsersFile = "/home/krowbar/Code/python/bannedUsers"
bannedWordsFile = "/home/krowbar/Code/python/bannedWords" bannedWordsFile = "/home/krowbar/Code/python/bannedWords"
wordData = {} # keyed by "word" that contains a count wordData = {} # keyed by "word" that contains a count
#we only care about recent chats, let's say for the past two weeks #we only care about recent chats, let's say for the past sixteen hours
timeCutoff = calendar.timegm(time.gmtime()) - (2 * 7 * 24 * 60 * 60) timeTo = calendar.timegm(time.gmtime())
minOccurance = 10 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() bannedWords = open(bannedWordsFile).read().splitlines()
bannedUsers = open(bannedUsersFile).read().splitlines()
with open(logfile, "r") as log: with open(logfile, "r") as log:
for line in log: for line in log:
@@ -22,9 +27,13 @@ with open(logfile, "r") as log:
time = int(time) time = int(time)
except ValueError: except ValueError:
continue #There are some bad lines in the log file that we'll ignore if we can't parse continue #There are some bad lines in the log file that we'll ignore if we can't parse
if time > timeCutoff: if user in bannedUsers:
for word in re.sub('[\'\";:,.?!*&^\-()\[\]]', '', message).lower().split(): continue #We don't care what they say
if word in bannedWords: 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 continue
#if the word already exists in the list #if the word already exists in the list
if word in wordData: if word in wordData:
@@ -33,6 +42,8 @@ with open(logfile, "r") as log:
wordData[word] = 1 wordData[word] = 1
#print "Added word: " + word #print "Added word: " + word
wordData = {i:wordData[i] for i in wordData if wordData[i] >= minOccurance } 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: with open(outfile + ".tmp", "w") as tmpFile:
tmpFile.write(json.dumps(wordData)) tmpFile.write(json.dumps(wordData))
shutil.move(outfile + ".tmp", outfile) shutil.move(outfile + ".tmp", outfile)
-21
View File
@@ -1,21 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Who chats and when?</title>
</head>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.min.js"></script>
<script type="text/javascript">
userData = {};
jQuery.getJSON("/~krowbar/data/userData.json", function(json) {
userData = json;
});
</script>
<body>
Here's some stuff! Check the console for userData
<br/>
Maybe I should use Google charts again instead of D3. Remember to use .setUTCSeconds()
</body>
</html>
-26
View File
@@ -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
+61 -7
View File
@@ -1,6 +1,35 @@
<!DOCTYPE html> <!DOCTYPE html>
<meta charset="utf-8"> <meta charset="utf-8">
<body> <body>
<div>
<select id="series">
<option value="">Today</option>
<option value="_2015_09">Sep 2015</option>
<option value="_2015_08">Aug 2015</option>
<option value="_2015_07">July 2015</option>
<option value="_2015_06">June 2015</option>
<option value="_2015_05">May 2015</option>
<option value="_2015_04">Apr 2015</option>
<option value="_2015_03">Mar 2015</option>
<option value="_2015_02">Feb 2015</option>
<option value="_2015_01">Jan 2015</option>
<option value="_2014_12">Dec 2014</option>
<option value="_2014_11">Nov 2014</option>
<option value="_2014_10">Oct 2014</option>
<option value="_all_time">All Time</option>
</select>
<select id="howMuch">
<option value=0>All words</option>
<option value=1>Less words</option>
<option value=2>Lesser words</option>
<option value=3>Lessest words</option>
<select>
<button type="button"
onclick="getWords('/~krowbar/data/chatcloud' + document.getElementById('series').value + '.json',
document.getElementById('howMuch').value)"
>Generate Cloud</button>
</div>
<div id="cloud"></div>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script> <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.js"></script>
<script type="text/javascript" src="d3.layout.cloud.js"></script> <script type="text/javascript" src="d3.layout.cloud.js"></script>
@@ -8,30 +37,54 @@
<script>(function() { <script>(function() {
var fill = d3.scale.category20(); var fill = d3.scale.category20();
var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
layout = d3.layout.cloud(); layout = d3.layout.cloud();
jQuery.getJSON("/~krowbar/data/chatcloud.json", function(json) { maxSize = 10; //default
getWords = function(source, fraction) {
jQuery.getJSON(source, function(json) {
delete json.length; //if one of our words is the word "length", it messes up the count
jsonWords = []; jsonWords = [];
maxCount = _.max(json);
minCount = _.min(json);
if(source.indexOf('_') == -1) {
var d = new Date();
jsonWords.push({text: months[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear(), size: maxCount+1});
}
//eliminate the bottom 10% * fraction items
threshold = minCount + Math.floor(( maxCount - minCount) * fraction / 10);
console.log("Out of",_.size(json), "words from", source, "with count", minCount, "to", maxCount,": adding words at least",threshold);
//console.log(json);
data = json;
_.forEach(json, function(count, word) { _.forEach(json, function(count, word) {
console.log("Added", word, count); if(isNaN(count)) { console.log("DANGER!:", word, "is", count); };
if(count >= threshold) {
//console.log("Added", word, count);
jsonWords.push({text: word, size: count}); jsonWords.push({text: word, size: count});
}
}); });
maxSize = Math.sqrt(maxCount);
layout layout
.size([1200, 800]) .size([1200, 800])
.words(jsonWords) .words(jsonWords)
.padding(5) .padding(3)
.rotate(function() { return ~~(Math.random() * 2) * 90; }) .rotate(function() { return ~~(Math.random() * 2) * 90; })
.font("Impact") .font("Impact")
.fontSize(function(d) { return d.size * 2 / 3; }) .fontSize(function(d) { return Math.sqrt(d.size) * 50 / maxSize + 6; })
.on("end", draw); .on("end", draw);
layout.start(); layout.start();
}); })};
getWords("/~krowbar/data/chatcloud.json", 1);
draw = function(words) { draw = function(words) {
console.log("Started draw with", words); console.log("Started draw with", words.length, "words");
d3.select("body").append("svg") d3.select("svg").remove();
d3.select("#cloud").append("svg")
.attr("width", layout.size()[0]) .attr("width", layout.size()[0])
.attr("height", layout.size()[1]) .attr("height", layout.size()[1])
.append("g") .append("g")
@@ -50,3 +103,4 @@ draw = function(words) {
} }
})();</script> })();</script>
</body>
+13 -5
View File
@@ -1,14 +1,22 @@
<html> <html>
<head> <head>
<title>WIP</title> <title>~krowbar's home page</title>
</head> </head>
<body> <body>
<h2>I just clobbered my index.html file</h2> Links and stuff
<h3>New site some time soon</h3>
<ul> <ul>
<li><a href="chatchecker/">Tilde.town IRC Chat checker</a></li>
<li><a href="twine2/">Twine 2.0</a></li> <li><a href="twine2/">Twine 2.0</a></li>
<li><a href="mission/">Mission name generator</a></li> <li><a href="grimoire/app/">Grimoire: The Pathfinder Item Roller</a></li>
<li><a href="Grimoire/">Grimoire: The Pathfinder Item Roller</a></li>
<li><a href="https://github.com/RussellChamp/PragmaticDiceBag">Pragmatic Dice Bag</a></li> <li><a href="https://github.com/RussellChamp/PragmaticDiceBag">Pragmatic Dice Bag</a></li>
</ul> </ul>
<h2><a href="chatcloud/">Tilde.town IRC Chat cloud</a></h2>
<iframe width=1200 height=800 frameborder=0 scrolling="no" src="chatcloud/"></iframe>
<h2><a href="mission/">Mission name generator</a></h2>
<iframe width=1200 height=200 frameborder=0 scrolling="no" src="mission/"></iframe>
<h2><a href="du/">Tilde.town disk usage</a></h2>
<iframe width=1200 height=1200 frameborder=0 scrolling="no" src="du/"></iframe>
</body> </body>
+9 -5
View File
@@ -7,20 +7,24 @@
var self = this; 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 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','Shield','Stand','Star','Storm','Streak','Sun','Thunder','Wind','Wrath'); 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','Violet','White','Yellow'); var colors = Array('Black','Blue','Brown','Gray','Green','Indego','Orange','Purple','Rainbow','Red','Scarlet','Silver','Violet','White','Yellow');
var actors = Array('Condor','Eagle','Guardian','Hawk','Hydra','Lady','Lion','Scorpion','Spartan','Titan','Victor','Viking','Warrior'); 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( var mission_grammars = Array(
{chance:30, grammar: 'adj1 + " " + noun1'}, {chance:30, grammar: 'adj1 + " " + noun1'},
{chance:20, grammar: 'adj1 + " " + actor'},
{chance:10, grammar: 'color + " " + noun1'}, {chance:10, grammar: 'color + " " + noun1'},
{chance:10, grammar: 'color + " " + actor'}, {chance:10, grammar: 'color + " " + actor'},
{chance:10, grammar: 'actor +"\'s " + noun1'}, {chance:10, grammar: 'actor +"\'s " + noun1'},
{chance:10, grammar: 'noun1 + " of the " + noun2'}, {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 " + noun2'},
{chance:10, grammar: 'noun1 + " of " + color + " " + noun2'}, {chance:10, grammar: 'noun1 + " of " + color + " " + noun2'},
{chance:10, grammar: 'adj1 + " " + noun1 + " and " + adj2 + " " + 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) { this.getNoun = function(badNouns) {
return _.chain(nouns) return _.chain(nouns)