Added chatgraph

This commit is contained in:
Russell 2020-03-02 16:31:58 -05:00
parent a911d0e01b
commit 210200a883
7 changed files with 210 additions and 39 deletions

View File

@ -1 +1 @@
73 5

View File

@ -1,18 +1,18 @@
krowbar&^%2982&^%1560533744.873656 krowbar&^%3104&^%1582898489.505324
karlen&^%498&^%1527613440 karlen&^%498&^%1527613440
endorphant&^%809&^%1444775660 endorphant&^%809&^%1444775660
jumblesale&^%25&^%1426171214 jumblesale&^%25&^%1426171214
marcus&^%2578&^%1549650312.011321 marcus&^%2588&^%1563801954.998879
papa&^%181&^%1474509971 papa&^%181&^%1474509971
epicmorphism&^%15&^%1546280322 epicmorphism&^%15&^%1546280322
audy&^%83&^%1504564254 audy&^%83&^%1504564254
kc&^%28&^%1480730333 kc&^%28&^%1480730333
vilmibm&^%24&^%1540452691 vilmibm&^%27&^%1564090719.590443
cmr&^%2244&^%1485978592 cmr&^%2244&^%1485978592
imt&^%519&^%1424087616 imt&^%519&^%1424087616
cndorphant&^%788&^%1424094192 cndorphant&^%788&^%1424094192
rain&^%17&^%1422310975 rain&^%17&^%1422310975
sl2c&^%769&^%1524856648 sl2c&^%774&^%1570301979.268798
selfsame&^%1&^%1422230012 selfsame&^%1&^%1422230012
bear&^%424&^%1510759605 bear&^%424&^%1510759605
coaxial&^%8&^%1422325983 coaxial&^%8&^%1422325983
@ -40,7 +40,7 @@ xkeeper&^%201&^%1539193279
cosnok&^%807&^%1508878859 cosnok&^%807&^%1508878859
escobar&^%1&^%1475431401 escobar&^%1&^%1475431401
amicabot&^%30&^%1481225205 amicabot&^%30&^%1481225205
caff&^%1047&^%1558110921.231633 caff&^%1049&^%1563832597.322066
kadin&^%19&^%1541514839 kadin&^%19&^%1541514839
desvox&^%69&^%1557959318.778502 desvox&^%69&^%1557959318.778502
mankins&^%3&^%1480211581 mankins&^%3&^%1480211581
@ -50,11 +50,11 @@ evilbot&^%4&^%1480693919
tybaltcat&^%7&^%1481076625 tybaltcat&^%7&^%1481076625
Minerbot&^%328&^%1548433782 Minerbot&^%328&^%1548433782
mio&^%347&^%1529720473 mio&^%347&^%1529720473
tehfraga&^%847&^%1560136790.62556 tehfraga&^%878&^%1580530799.560572
sushi&^%10&^%1493253212 sushi&^%10&^%1493253212
troido&^%337&^%1557994464.437409 troido&^%357&^%1583138825.262537
gamebot&^%427&^%1557994509.816703 gamebot&^%458&^%1583138837.531898
nilaky&^%2183&^%1560326842.896281 nilaky&^%2728&^%1583177932.287866
bucket&^%103&^%1507931139 bucket&^%103&^%1507931139
lolbot&^%1&^%1502568407 lolbot&^%1&^%1502568407
m455&^%12&^%1550095510.913918 m455&^%12&^%1550095510.913918
@ -67,7 +67,7 @@ pinhook&^%8&^%1509744722
emfor&^%3&^%1509671353 emfor&^%3&^%1509671353
k2l8m11n2&^%11&^%1510932395 k2l8m11n2&^%11&^%1510932395
sacredpixel&^%3&^%1522082931 sacredpixel&^%3&^%1522082931
login&^%3925&^%1560522470.792367 login&^%4941&^%1583130053.148477
kelpiebot&^%3&^%1513101957 kelpiebot&^%3&^%1513101957
unreal&^%4&^%1550140674.610166 unreal&^%4&^%1550140674.610166
kinsey&^%26&^%1520446672 kinsey&^%26&^%1520446672
@ -77,12 +77,12 @@ wuz&^%3&^%1518125300
hashdang&^%4&^%1518666906 hashdang&^%4&^%1518666906
ubergeek&^%63&^%1530410162 ubergeek&^%63&^%1530410162
silver&^%9&^%1519333029 silver&^%9&^%1519333029
equa&^%96&^%1555952114.070098 equa&^%97&^%1560629470.846509
audiodude&^%2&^%1519453927 audiodude&^%2&^%1519453927
whimsy&^%47&^%1529678733 whimsy&^%47&^%1529678733
wangofett&^%301&^%1559063459.270142 wangofett&^%301&^%1559063459.270142
saturn&^%3&^%1521429369 saturn&^%3&^%1521429369
lucidiot&^%28&^%1526201925 lucidiot&^%30&^%1568931512.530742
tracer&^%1&^%1555609910.591965 tracer&^%1&^%1555609910.591965
jan6&^%1396&^%1550244555.585356 jan6&^%1396&^%1550244555.585356
eeeeeta&^%55&^%1540361066 eeeeeta&^%55&^%1540361066
@ -93,10 +93,10 @@ Halian&^%32&^%1528360263
lunasspecto&^%4&^%1524164784 lunasspecto&^%4&^%1524164784
severak&^%17&^%1546438400 severak&^%17&^%1546438400
ralph&^%4&^%1526980620 ralph&^%4&^%1526980620
von&^%503&^%1557219954.340999 von&^%509&^%1577982882.974879
ensis&^%1750&^%1546853217 ensis&^%1750&^%1546853217
simon&^%26&^%1527937489 simon&^%26&^%1527937489
benharri&^%4176&^%1560525087.641036 benharri&^%4667&^%1582998577.099369
cpb&^%3&^%1528930564 cpb&^%3&^%1528930564
calmbit&^%167&^%1555374194.542602 calmbit&^%167&^%1555374194.542602
wisebot&^%5652&^%1539612163 wisebot&^%5652&^%1539612163
@ -106,41 +106,41 @@ x4464&^%1&^%1532028546
pounce&^%19&^%1532133325 pounce&^%19&^%1532133325
livix&^%7&^%1533603142 livix&^%7&^%1533603142
ben&^%3&^%1551976138.688011 ben&^%3&^%1551976138.688011
npa&^%521&^%1560424478.878421 npa&^%563&^%1582367595.970517
ezo&^%6&^%1533883842 ezo&^%6&^%1533883842
aliasless&^%36&^%1541001821 aliasless&^%36&^%1541001821
kirch&^%725&^%1559152397.415157 kirch&^%725&^%1578410244.990123
root&^%2&^%1535558514 root&^%5&^%1572401194.438134
byte&^%5&^%1536416308 byte&^%5&^%1536416308
qbe&^%7&^%1537850181 qbe&^%7&^%1537850181
informativeheck&^%3&^%1536733938 informativeheck&^%3&^%1536733938
h00fi&^%1&^%1537050053 h00fi&^%1&^%1537050053
fantoro&^%59&^%1550270271.196303 fantoro&^%61&^%1572950895.174425
tildethief&^%7421&^%1542132794 tildethief&^%7421&^%1542132794
benjaminwil&^%634&^%1560191813.362556 benjaminwil&^%644&^%1565375839.586108
deltawitch&^%3562&^%1553465376.049636 deltawitch&^%3682&^%1575993870.271857
archangelic&^%492&^%1551543505.698955 archangelic&^%492&^%1551543505.698955
diodelass&^%11&^%1550243960.964821 diodelass&^%11&^%1550243960.964821
minerobber&^%436&^%1556768081.823201 minerobber&^%440&^%1579278135.397494
brendantcc&^%7&^%1556763317.210358 brendantcc&^%9&^%1578187123.570653
dozens&^%21&^%1541090333 dozens&^%21&^%1541090333
bowlercaptain&^%6&^%1540926135 bowlercaptain&^%6&^%1540926135
nicole&^%6&^%1541276844 nicole&^%6&^%1541276844
littlebigly&^%49&^%1541283119 littlebigly&^%49&^%1541283119
ahriman&^%835&^%1554866586.935765 ahriman&^%835&^%1554866586.935765
tunas&^%117&^%1560298163.175462 tunas&^%190&^%1582056632.044472
netscape_navigator&^%6&^%1558110962.20274 netscape_navigator&^%6&^%1558110962.20274
roan&^%5&^%1545846612 roan&^%5&^%1545846612
ckipp01&^%3&^%1545813774 ckipp01&^%3&^%1545813774
ben&^%4&^%1551976138.688011 ben&^%4&^%1551976138.688011
l0010o0001l&^%3&^%154529473 l0010o0001l&^%5&^%1573253165.316188
rgdrake&^%1&^%1546086404 rgdrake&^%1&^%1546086404
handyc&^%5&^%1546456002 handyc&^%5&^%1546456002
fosslinux&^%61&^%1560322972.356979 fosslinux&^%66&^%1578902600.917223
banterbot&^%3&^%1547588758 banterbot&^%3&^%1547588758
testgamebot&^%4&^%1547722176 testgamebot&^%4&^%1547722176
minerobber2&^%60&^%1559063617.783532 minerobber2&^%112&^%1581914588.859241
minerbot&^%118&^%1559063632.795964 minerbot&^%168&^%1581914599.82027
desvox__&^%2&^%1549262081.083705 desvox__&^%2&^%1549262081.083705
roy&^%121&^%1552723964.563934 roy&^%121&^%1552723964.563934
diodelasses&^%19&^%1551139645.230519 diodelasses&^%19&^%1551139645.230519
@ -149,22 +149,35 @@ strdg&^%2&^%1551967813.490182
kneezle&^%7&^%1552213173.813114 kneezle&^%7&^%1552213173.813114
clarjon1&^%10&^%1560530935.588749 clarjon1&^%10&^%1560530935.588749
vantablack&^%4&^%1558130984.593398 vantablack&^%4&^%1558130984.593398
stilbruch&^%2&^%1554903426.825374 stilbruch&^%2&^%1563818727.379952
rscham&^%6&^%1558069762.853566 rscham&^%6&^%1558069762.853566
barf&^%11&^%1556183600.617767 barf&^%11&^%1556183600.617767
wingy&^%31&^%1559428066.074812 wingy&^%39&^%1567716587.956104
gigavinyl&^%2&^%1556759858.270947 gigavinyl&^%2&^%1556759858.270947
amcclure&^%3&^%1557108990.625545 amcclure&^%3&^%1557108990.625545
coworker&^%4&^%1557454828.446457 coworker&^%4&^%1557454828.446457
wizard&^%6&^%1557524532.359075 wizard&^%9&^%1564789336.13831
pie&^%6&^%1557738895.63107 pie&^%8&^%1572857423.930217
Brendan&^%1&^%1557787795.608407 Brendan&^%1&^%1557787795.608407
haskal&^%9&^%1558321215.072781 haskal&^%13&^%1564323672.918303
tawseef&^%6&^%1558976694.056738 tawseef&^%6&^%1558976694.056738
artemis&^%8&^%1559064594.403519 artemis&^%8&^%1559064594.403519
teddysc&^%3&^%1558967130.362884 teddysc&^%3&^%1558967130.362884
realname&^%1&^%1559070381.420153 realname&^%1&^%1559070381.420153
wangofett1&^%2&^%1559675500.939273 wangofett1&^%2&^%1559675500.939273
ear7h&^%7&^%1560326126.779239 ear7h&^%99&^%1567231966.097758
notopygos&^%2&^%1560322354.192917 notopygos&^%45&^%1563276214.822798
cori&^%2&^%1560318891.130722 cori&^%2&^%1560318891.130722
elw&^%1&^%1561578394.518494
tanner&^%15&^%1561951485.176371
knuxify&^%55&^%1562263901.715678
eigenellies&^%4&^%1564265069.632661
gaffen&^%6&^%1567001270.870111
den&^%3&^%1568395158.336022
Wingy&^%31&^%1573578029.139008
petra&^%42&^%1581129779.114463
fossy&^%5&^%1580027303.501532
sortai&^%6&^%1578517619.132031
fluora&^%2&^%1580000493.510967
mag&^%4&^%1581770503.359329
patrick&^%3&^%1583003265.449332

View File

@ -163,9 +163,10 @@ def make_puzzle(obfuscate=True, roll=None):
elif roll <= 17: # 15-17 elif roll <= 17: # 15-17
answer, puzzle = util.dict_puzzle.get_anagram() answer, puzzle = util.dict_puzzle.get_anagram()
obfuscate = False obfuscate = False
elif roll == 18: #elif roll == 18:
answer, puzzle = util.quote_puzzle.get_chuck() # answer, puzzle = util.quote_puzzle.get_chuck()
obfuscate = False # # these were just getting too nasty
# obfuscate = False
elif roll <= 20: #19-20 elif roll <= 20: #19-20
captcha = util.textcaptcha.get_captcha() captcha = util.textcaptcha.get_captcha()
puzzle = captcha['q'] # the question part of the captcha puzzle = captcha['q'] # the question part of the captcha

View File

@ -188,7 +188,8 @@ def get_bad_thing():
"actually answered the last question", "actually answered the last question",
"has their pants on backwards", "has their pants on backwards",
"forgot their own name", "forgot their own name",
"got me really confused" "got me really confused",
"is a gambler"
] ]
) )

76
Code/python/chatgraph.py Executable file
View File

@ -0,0 +1,76 @@
#!/usr/bin/python3
import fileinput
import json
import time
import calendar
import re
import shutil
import argparse
import logging, sys
import math
import os
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
parser = argparse.ArgumentParser(
description="Generate word list data based off of aggregate irc chat logs"
)
parser.add_argument(
"-outfile",
help="output file to write to",
default="/home/krowbar/logs/chatcloud_aggregate.json"
)
parser.add_argument(
"-logpath",
type=str,
help="where the log files are kept",
default="/home/krowbar/logs",
)
parser.add_argument
args = parser.parse_args()
chatData = {
"columns": [ "__TIMESTAMP__" ],
"data": []
}
logging.info(
"Generating word graph based off words from " + args.logpath
)
logs = sorted([f for f in os.listdir(args.logpath) if re.match(r'chatcloud_[0-9]{4}_[0-9]{2}.json', f)])
for log in logs:
date = re.findall("[0-9]{4}_[0-9]{2}", log)[0]
year = re.findall("[0-9]{4}", date)[0]
if year < '2019':
continue
print("Processing: {}...".format(log), end='')
logData = [ date ]
with open(os.path.join(args.logpath, log), "r") as logfile:
j = json.load(logfile);
for col in chatData['columns']:
if col in j.keys():
logData.append(j[col])
elif col is not "__TIMESTAMP__":
logData.append(0)
for key in j.keys():
if key in chatData['columns']:
continue
else:
chatData['columns'].append(key)
for d in chatData['data']:
d.append(0)
# append a 0 in each other chatData.data rows
logData.append(j[key])
chatData['data'].append(logData);
print(" Columns: {}, Records: {}".format(len(chatData['columns']), len(logData)))
with open(args.outfile + ".tmp", "w") as tmpFile:
tmpFile.write(json.dumps(chatData))
# shutil.move(args.outfile + ".tmp", args.outfile)
print("Dumped {} records to {}".format(len(chatData['columns']), args.outfile))

View File

@ -0,0 +1,71 @@
<html>
<head>
<title>Tilde Chat Frequency</title>
<style>
body {
background-color: wheat;
}
</style>
</head>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js"></script>
<script type="text/javascript" src="https://momentjs.com/downloads/moment.js"></script>
<script type="text/javascript">
google.charts.load('current', { packages: ['corechart', 'line' ]});
google.charts.setOnLoadCallback(drawLineChart);
function drawLineChart() {
var data = new google.visualization.DataTable();
jQuery.getJSON("/~krowbar/data/chatcloud_aggregate.json", function(json) {
var words = [];
json.columns.slice(1).forEach(function(col, idx) {
words.push({ 'word': col, 'index': idx + 1, 'value': _.reduce(json.data, function(sum, row) { return sum + row[idx + 1]; }, 0) });
});
// sort them
words = _.orderBy(words, ['value', 'word'], ['desc', 'asc']);
// only take the top 100
START_IDX = 0;
MAX_SIZE = 100;
words = words.slice(START_IDX, MAX_SIZE);
data.addColumn('date', 'Month');
words.forEach(function(col) {
data.addColumn('number', col.word);
});
var goodIdxs = _.map(words, function(item) { return item.index; });
var mungedData = _.map(json.data, function(row) {
var data = [moment(row[0], "YYYY_MM").toDate()];
goodIdxs.forEach(function(idx) {
data.push(row[idx]);
});
return data;
});
data.addRows(mungedData);
var options = {
chart: {
title: 'Tilde Town Chat Word Frequency',
subtitle: 'across time and space'
},
vAxis: {
logScale: true
},
width: 1200,
height: 600
};
var chart = new google.charts.Line(document.getElementById('linechart'));
chart.draw(data, google.charts.Line.convertOptions(options));
});
}
</script>
<body>
<div id="linechart"></div>
<div>
<a href="https://github.com/RussellChamp/tilde-projects/tree/master/Code/bash">(see source)</a>
</div>
</body>

View File

@ -13,6 +13,15 @@
<div> <div>
<select id="series"> <select id="series">
<option value="">Today</option> <option value="">Today</option>
<option value="_2020_02">Feb 2020</option>
<option value="_2020_01">Jan 2020</option>
<option value="_2019_12">Dec 2019</option>
<option value="_2019_11">Nov 2019</option>
<option value="_2019_10">Oct 2019</option>
<option value="_2019_09">Sep 2019</option>
<option value="_2019_08">Aug 2019</option>
<option value="_2019_07">Jul 2019</option>
<option value="_2019_06">Jun 2019</option>
<option value="_2019_05">May 2019</option> <option value="_2019_05">May 2019</option>
<option value="_2019_04">Apr 2019</option> <option value="_2019_04">Apr 2019</option>
<option value="_2019_03">Mar 2019</option> <option value="_2019_03">Mar 2019</option>