Lots of little random things

This commit is contained in:
Russell 2018-01-24 20:51:54 +00:00
parent c89ac52460
commit 1849bd34e5
14 changed files with 106 additions and 45 deletions

View File

@ -138,9 +138,11 @@ def define_word(channel, user, text):
defs = defWord(word)
if(len(defs) == 0):
ircsock.send("PRIVMSG " + channel + " :" + user + ": Couldn't find the definition of '" + word + "' :(\n")
else:
elif(isinstance(defs, list)):
for entry in defs:
ircsock.send("PRIVMSG " + channel + " :" + user + ": Define '" + word + "'" + entry[0:400] + "\n")
else:
ircsock.send("PRIVMSG " + channel + " :" + user + ": Define '" + word + "'" + defs[0:400] + "\n")
def make_rainbow(channel, user, text):
rbword = makeRainbow(text[9:])

View File

@ -5,15 +5,18 @@ import quote_puzzle
p = inflect.engine()
primes = [11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]
fuzz_amount = 3
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,10)
roll = random.randrange(0,12)
var1 = random.randrange(1,10)
var2 = random.randrange(1,10)
var3 = random.randrange(1,20)
var4 = random.randrange(1,20)
let1_ord = random.randrange(ord('a'), ord('z')+1)
if roll == 0:
@ -60,10 +63,16 @@ def make_puzzle(obfuscate=True):
elif roll == 9:
answer, puzzle = quote_puzzle.get_quote()
obfuscate = False
elif roll == 10:
answer = str(min(var1, var2, var3, var4))
puzzle = "What is the " + random.choice(["smallest", "lowest"]) + " of " + p.number_to_words(var1) + ", " + p.number_to_words(var2) + ", " + p.number_to_words(var3) + ", and " + p.number_to_words(var4)
elif roll == 11:
answer = str(max(var1, var2, var3, var4))
puzzle = "What is the " + random.choice(["biggest", "largest"]) + " of " + p.number_to_words(var1) + ", " + p.number_to_words(var2) + ", " + p.number_to_words(var3) + ", and " + p.number_to_words(var4)
puzzle += "?"
if obfuscate == True:
for _ in range(3):
for _ in range(fuzz_amount):
idx = random.randrange(len(puzzle)-1) #get between 0 and string length
puzzle = ''.join([puzzle[0:idx], chr(random.randint(33,126)), puzzle[idx+1:]])
return [answer, puzzle]

View File

@ -1,20 +1,20 @@
krowbar&^%1787&^%1501780034
krowbar&^%1980&^%1516734495
karlen&^%277&^%1472020404
endorphant&^%682&^%1444775660
jumblesale&^%24&^%1426171214
marcus&^%2291&^%1501781989
marcus&^%2500&^%1511361157
papa&^%181&^%1474509971
epicmorphism&^%5&^%1421937744
audy&^%78&^%1466749239
audy&^%83&^%1504564254
kc&^%28&^%1480730333
vilmibm&^%15&^%1501441899
cmr&^%2244&^%1485978592
imt&^%519&^%1424087616
cndorphant&^%788&^%1424094192
rain&^%17&^%1422310975
sl2c&^%125&^%1501538196
sl2c&^%607&^%1516805296
selfsame&^%1&^%1422230012
bear&^%417&^%1497642976
bear&^%424&^%1510759605
coaxial&^%8&^%1422325983
joe&^%8&^%1422325983
hardmath123&^%4&^%1422325983
@ -28,7 +28,7 @@ reppard&^%11&^%1437512059
jesse&^%6&^%1437569027
khoi&^%3&^%1438044039
sanqui&^%22&^%1474904633
endorphan&^%107&^%1480548353
endorphan&^%113&^%1512851444
cndorphbo&^%9&^%1466591324
santi&^%3&^%1447873216
insom&^%1&^%1450346059
@ -39,28 +39,42 @@ synergian&^%22&^%1458152889
dheeraj&^%5&^%1456489270
demobot&^%6&^%1454439605
premysl&^%65&^%1461768606
minerobbe&^%104&^%1501731278
minerobbe&^%179&^%1510228411
xkeeper&^%14&^%1461967961
cosnok&^%806&^%1500595904
cosnok&^%807&^%1508878859
escobar&^%1&^%1475431401
amicabot&^%30&^%1481225205
caff&^%665&^%1501724448
caff&^%877&^%1516766053
kadin&^%5&^%1479870008
desvox&^%5&^%1481632697
mankins&^%3&^%1480211581
cinch&^%2&^%1480454755
caffbot&^%741&^%1501724457
caffbot&^%904&^%1516766061
evilbot&^%4&^%1480693919
tybaltcat&^%7&^%1481076625
minerbot&^%69&^%1501731322
mio&^%233&^%1501802809
archangel&^%183&^%1501670693
tehfraga&^%89&^%1501596505
minerbot&^%94&^%1510228403
mio&^%339&^%1506434277
archangel&^%414&^%1515441099
tehfraga&^%193&^%1516622757
sushi&^%10&^%1493253212
troido&^%72&^%1498923648
gamebot&^%14&^%1498598594
nilaky&^%275&^%1501796944
bucket&^%65&^%1501802788
lolbot&^%1&^%1499116802
m455&^%3&^%1500572529
troido&^%109&^%1515268965
gamebot&^%49&^%1514748179
nilaky&^%864&^%1515807984
bucket&^%103&^%1507931139
lolbot&^%1&^%1502568407
m455&^%12&^%1512076715
abraxas&^%3&^%1500665540
nilakybot&^%7&^%1503006301
greely&^%70&^%1509386334
splatoon&^%3&^%1506133915
feoh&^%48&^%1513959989
pinhook&^%8&^%1509744722
emfor&^%3&^%1509671353
k2l8m11n2&^%11&^%1510932395
sacredpix&^%2&^%1510943959
deltawitc&^%362&^%1516822359
login&^%14&^%1516797327
kelpiebot&^%3&^%1513101957
unreal&^%1&^%1514940020
tildethie&^%694&^%1516825682
kinsey&^%23&^%1515732346

View File

@ -32,3 +32,6 @@
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
1493646477&^%krowbar&^%Name your favorite song.
1512345295&^%deltawitc&^%All hail DeltaWitch the Bot Queen
1515522818&^%deltawitc&^%All hail DeltaWitch the Bot Queen (and promising pupper)
1516797394&^%login&^%If you join the circus, what would you perform?

View File

@ -199,3 +199,27 @@
1501608305&^%vilmibm&^%fill out the Town Census Survey! https://goo.gl/forms/XHVHSa9iEI2c9OVI2
1501612028&^%vilmibm&^%fill out the Town Census Survey! https://goo.gl/forms/XHVHSa9iEI2c9OVI2 | we have a duolingo club!!!! use code QEJZS9
1501614893&^%vilmibm&^%fill out the Town Census Survey! https://goo.gl/forms/XHVHSa9iEI2c9OVI2 | new channels! #duolino , #gaming
1502135953&^%vilmibm&^%fill out the Town Census Survey! https://goo.gl/forms/XHVHSa9iEI2c9OVI2 | new channels! #duolingo , #gaming
1502390992&^%vilmibm&^%new channels! #duolingo , #gaming"
1502391055&^%vilmibm&^%new channels! #duolingo (for language learners), #gaming (general non starbound gaming), #dumpsterfire (for political chat)
1506987998&^%vilmibm&^%hugs
1507731864&^%vilmibm&^%HAPPY 3RD BIRTHDAY!
1508903244&^%vilmibm&^%welcome, kilotownie!
1509473409&^%vilmibm&^%happy halloween!!!!!
1509476060&^%vilmibm&^%happy halloween!! | what's the scariest thing that ever happened to you in a terminal?
1509947580&^%vilmibm&^%<3 <3 <3
1510083597&^%vilmibm&^%friends, mind doing some home directory cleanup? vil is working on adding more space but we could use some breathing room
1510086733&^%vilmibm&^%nanohugmo
1511079918&^%vilmibm&^%rostral dorsolateral pontine tegmentum
1512353711&^%vilmibm&^%RIP uptime
1512426167&^%vilmibm&^%town movie night, this thursday! 1900 PST! link for stream TBD~
1512678067&^%vilmibm&^%VOTE ON TONIGHT'S MOVIE http://www.strawpoll.me/14570324 | MOVIE NIGHT TONIGHT 1900 PST | LINK TBD
1512691002&^%vilmibm&^%VOTE ON TONIGHT'S MOVIE! 3 hours left! http://www.strawpoll.me/14570324 | MOVIE NIGHT AT 1900 PST | STREAM LINK: https://www.youtube.com/watch?v=JzPg-GxM404
1512691705&^%vilmibm&^%VOTE ON TONIGHT'S MOVIE! 3 hours left! http://www.strawpoll.me/14570324 | MOVIE NIGHT AT 1900 PST | stream link tbd
1512697169&^%vilmibm&^%VOTE ON TONIGHT'S MOVIE! 3 hours left! http://www.strawpoll.me/14570324 | MOVIE NIGHT AT 1900 PST | stream link rtmp://graveyardtheory.net:1935/mytv/feelsmustflow
1512702530&^%nate&^%MOVIE NIGHT! Directions to join: https://tilde.town/wiki/vlc.html
1512723236&^%nate&^%thx friends for a fun movie night~
1513284395&^%vilmibm&^%did you water your plant today?
1515124829&^%vilmibm&^%did you plant your water today?
1516211774&^%vilmibm&^%how are you?
1516797431&^%login&^%"have you planted your water?"

View File

@ -1,12 +1,3 @@
krowbar&^%17&^%30
vilmibm&^%0&^%84
hardmath123&^%0&^%6
joe&^%1&^%1jumblesale
audiodude&^%1&^%0
cmr&^%0&^%6
insom&^%1&^%0
premysl&^%0&^%1marcus&^%1&^%0
marcus&^%1&^%1
papa&^%1&^%0
desvox&^%1&^%0
mio&^%2&^%0
kinsey&^%2&^%0
vilmibm&^%0&^%1login&^%1&^%0
login&^%7&^%4

View File

@ -8,12 +8,13 @@ import re
import math
import operator
MAX_NODES = 5
MAX_NODES = 4
logfile = "/home/jumblesale/Code/irc/log"
logfile = "/home/archangelic/irc/log"
#logfile = "/home/jumblesale/Code/irc/log"
outfile = "/home/krowbar/logs/chatBesties.json"
outCircle = "/home/krowbar/logs/chatcircle.json"
timePeriod = calendar.timegm(time.gmtime()) - (3 * 7 * 24 * 60 * 60) #3 weeks
timePeriod = calendar.timegm(time.gmtime()) - (2 * 7 * 24 * 60 * 60) #2 weeks
userData = {} #hash keyed by "user" that contains a hash of mentioned other users with count
nameFix = {
@ -31,6 +32,8 @@ with open(logfile, "r") as log:
for line in log:
try:
time, user, message = line.split("\t", 3)
if int(time) < timePeriod:
continue #only add users who have spoken in the last period
if nameFix.has_key(user):
user = nameFix[user]
else:
@ -86,12 +89,12 @@ d3data['links'] = []
#Now connect all the pople to their stuff
for user, values in userData.iteritems():
#give the user a 'group' based on their total score
d3data['nodes'][values['id']]['group'] = int(math.ceil(math.sqrt(math.sqrt(values['score']))))
d3data['nodes'][values['id']]['group'] = int(math.ceil(math.log(values['score'])))
besties = sorted(values['data'].items(), key=operator.itemgetter(1), reverse=True)[0:MAX_NODES] #ONLY the top besties
for target, score in besties:
try:
print "Adding link from " + user + " (" + str(values['id']) + ") to " + target + " (" + str(userData[target]['id']) + ") with strength " + str(score)
d3data['links'].append({"source": values['id'], "target": userData[target]['id'], "value": math.ceil(math.sqrt(score))})
d3data['links'].append({"source": values['id'], "target": userData[target]['id'], "value": math.ceil(math.sqrt(score))*2 })
except KeyError:
print "! Error when trying to link " + user + " to " + target
continue

3
Code/python/chatchecker.py Normal file → Executable file
View File

@ -5,7 +5,8 @@ import time
import calendar
import shutil
logfile = "/home/jumblesale/Code/irc/log"
logfile = "/home/archangelic/irc/log"
#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 couple weeks

View File

@ -6,7 +6,8 @@ import calendar
import re
import shutil
logfile = "/home/jumblesale/Code/irc/log"
logfile = "/home/archangelic/irc/log"
#logfile = "/home/jumblesale/Code/irc/log"
outfile = "/home/krowbar/logs/chatcloud.json"
#outfile = "/home/krowbar/logs/chatcloud_2016_10.json"

3
Code/python/chatstats.py Normal file → Executable file
View File

@ -6,7 +6,8 @@ import calendar
import shutil
import re
logfile = "/home/jumblesale/Code/irc/log"
logfile = "/home/archangelic/irc/log"
#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

View File

@ -1,2 +1,6 @@
This is just some stuff I've worked on as a member of tilde.town
When the site ever goes away (and I know it will someday), I'll at least have a copy of all my silly, mostly-pointless projects.
TODO:
* 'musicBot' that will track musicforprogramming.net and post to IRC when a
new track is available

View File

@ -4,6 +4,11 @@
<div>
<select id="series">
<option value="">Today</option>
<option value="_2017_12">Dec 2017</option>
<option value="_2017_11">Nov 2017</option>
<option value="_2017_10">Oct 2017</option>
<option value="_2017_09">Sep 2017</option>
<option value="_2017_08">Aug 2017</option>
<option value="_2017_07">Jul 2017</option>
<option value="_2017_06">Jun 2017</option>
<option value="_2017_06">Jun 2017</option>

View File

@ -7,9 +7,10 @@
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.8.0/lodash.min.js"></script>
<script type="text/javascript">
google.load("visualization", "1.1", {packages:["corechart", "line"]});
google.setOnLoadCallback(drawCharts);
google.load("visualization", "1.1", {packages:["corechart", "line"], callback: drawCharts});
//google.setOnLoadCallback(drawCharts);
function drawCharts() {
console.log('called drawCharts!');
var data = new google.visualization.DataTable();
var piechart = new google.visualization.PieChart(document.getElementById('donutchart'));
@ -37,6 +38,7 @@
};
jQuery.getJSON("/~krowbar/data/du_log.json", function(json) {
console.log('loaded disk usage json data!');
date.setUTCSeconds(json[json.length-1].date);
//Draw PieChart
data.addRows(

View File

@ -14,6 +14,7 @@ Links and stuff
<li><a href="grimoire/app/">Grimoire: The Pathfinder Item Roller</a></li>
<li><a href="https://github.com/RussellChamp/PragmaticDiceBag">Pragmatic Dice Bag: Artsy fartsy guide!</a></li>
<li><a href="limericks/">Dumb Limericks</a></li>
<li><a href="rainycoffee/">Rainy Mood + Dark Coffee</a></li>
</ul>
<h2><a href="chatcloud/">Tilde.town IRC Chat cloud</a></h2>