Commit a4a8c20d authored by anne laforet's avatar anne laforet
Browse files

Merge branch 'master' of relearn:git/relearn

parents 4e6d2085 51066595
body { background: #fafafa;}
body.border { border: 3px solid red;}
#from { background: green; }
.open {
margin-left: 100px;
}
#from {
cursor: pointer;
display: inline-block;
transition-property: all;
transition-duration: .3s;
}
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="test.css" type="text/css" media="screen"/>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
</head>
<body>
<div class="border">
<div id="from">Tove</div>
<div>Jani</div>
<div>Reminder</div>
<div>Don't forget me this weekend!</div>
</div>
<script type="text/javascript">
$('#from').on('click', function (event) {
$(this).addClass('open')
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="test.css" type="text/css" media="screen"/>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
</head>
<body>
<div xmlns="http://www.w3.org/1999/xhtml" class="border">
<div class="open">Tove</div>
<div>Jani</div>
<div>Reminder</div>
<div>Don't forget me this weekend!</div>
</div>
<script type="text/javascript">
$('from').on('click', function (event) {
$(this).addClass('open')
});
</script>
</body>
</html>
\ No newline at end of file
body { background: #fafafa;}
body.border { border: 3px solid red;}
#from { background: green; }
.open {
margin-left: 100px;
}
#from {
cursor: pointer;
display: inline-block;
transition-property: all;
transition-duration: .3s;
}
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="test2.css" type="text/css" media="screen"/>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
</head>
<body>
<div class="border">
<div id="from">Tove</div>
<div>Jani</div>
<div>Reminder</div>
<div>Don't forget me this weekend!</div>
</div>
<script type="text/javascript">
$('#from').on('click', function (event) {
$(this).addClass('open')
});
</script>
</body>
</html>
\ No newline at end of file
......@@ -15,9 +15,24 @@
<ol style="list-style-type: decimal">
<li><p>Clone the (bare) repository into your webserver directory:</p>
<p>cd /var/www git clone /home/relearn/git/new_babylon.git/</p></li>
<li><p>Add a post-update hook on the bare repository to automatically pull when updated</p>
<p>cd cd git/new_babylon.git/hooks cp post-update.sample post-update chmod +x post-update nano post-update</p></li>
<li><p>Add a post-update hook on the bare repository to automatically pull (actually it fetches and hard resets to make sure it ALWAYS works) when updated:</p>
<p>cd cd git/new_babylon.git/hooks cp post-update.sample post-update</p>
<h1>mostly next step isn't necessary as it's already +x</h1>
<p>chmod +x post-update</p>
<p>nano post-update</p></li>
</ol>
<p>and edit this file to be:</p>
<pre><code>#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to &quot;post-update&quot;.
cd /path/to/www/repo || exit
unset GIT_DIR
git fetch --all
git reset --hard origin/master
exec git update-server-info</code></pre>
</body>
</html>
......@@ -11,15 +11,29 @@ TODO: document the setup on the relearn server.
cd /var/www
git clone /home/relearn/git/new_babylon.git/
2. Add a post-update hook on the bare repository to automatically pull when updated
2. Add a post-update hook on the bare repository to automatically pull (actually it fetches and hard resets to make sure it ALWAYS works) when updated:
cd
cd git/new_babylon.git/hooks
cp post-update.sample post-update
# mostly next step isn't necessary as it's already +x
chmod +x post-update
nano post-update
and edit this file to be:
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
cd /path/to/www/repo || exit
unset GIT_DIR
git fetch --all
git reset --hard origin/master
exec git update-server-info
======================================================
==============// \\==============
==============( CONSTANT_N IRC BOT )==============
==============\\ //==============
======================================================
Constant_n is a reincarnation of the infamous utopian architect Constant Nieuwenhuys through the IRC.
It reacts to certain stimulations and answers to certain questions. It also likes to pick some random citations form his text "Autodialogue on New Babylon", discussing with its former self through the labyrinths of time.
==================( ACTIVATION )==================
To activate it run in your terminal :
python constantbot/constantbot.py —host relearn "#2084" constant_n
......@@ -59,20 +59,20 @@ class HelloBot(irc.bot.SingleServerIRCBot):
'y':'it',
'z':'why',
' ':'.',
'.':'',
',':'window',
'.':'it ends',
',':'a window',
'!':'enormous',
'?':'I ask myself if that is really the case',
'0':'number',
'1':'number',
'2':'number',
'3':'number',
'4':'number',
'5':'number',
'6':'number',
'7':'number',
'8':'number',
'9':'number'
'0':'none',
'1':'the first',
'2':'the second',
'3':'the third',
'4':'the fourth',
'5':'the fifth',
'6':'the sixth',
'7':'the seventh',
'8':'the eighth',
'9':'the nineth'
}
m = e.arguments[0]
......
import socket
import sys
from random import randint
import re
#----------------------------------- Settings --------------------------------------#
network = '192.168.1.222'
port = 6667
homechan = '#2084'
botName = 'TestBot'
irc = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
irc.connect ( ( network, port ) )
print irc.recv ( 4096 )
irc.send ( 'PASS *********\r\n')
irc.send ( 'NICK '+ botName +'\r\n' )
irc.send ( 'USER ' + botName + ' ' + botName + ' ' + botName + ' :Python IRC\r\n' )
#----------------------------------------------------------------------------------#
#---------------------------------- Functions -------------------------------------#
def GetHost(host): # Return Host
host = host.split('@')[1]
host = host.split(' ')[0]
return host
def GetChannel(data): # Return Channel
channel = data.split('#')[1]
channel = channel.split(':')[0]
channel = '#' + channel
channel = channel.strip(' \t\n\r')
return channel
def GetNick(data): # Return Nickname
nick = data.split('!')[0]
nick = nick.replace(':', ' ')
nick = nick.replace(' ', '')
nick = nick.strip(' \t\n\r')
return nick
def Send(msg):
irc.send('PRIVMSG ' + homechan + ' : ' + msg + '\r\n')
def Join(chan):
irc.send ( 'JOIN ' + chan + '\r\n' )
def Part(chan):
irc.send ( 'PART ' + chan + '\r\n' )
def Op(to_op, chan):
irc.send( 'MODE ' + chan + ' +o: ' + to_op + '\r\n')
def DeOp(to_deop, chan):
irc.send( 'MODE ' + chan + ' -o: ' + to_deop + '\r\n')
def Voice(to_v, chan):
irc.send( 'MODE ' + chan + ' +v: ' + to_v + '\r\n')
def DeVoice(to_dv, chan):
irc.send( 'MODE ' + chan + ' -v: ' + to_dv + '\r\n')
#------------------------------------------------------------------------------#
#-----------------Initial Variables--------------------------------------------#
#------------------------------------------------------------------------------#
while True:
action = 'none'
data = irc.recv ( 4096 )
print data
if data.find ( 'hello' ) != -1:
Send("Hi!")
#------------------------------------------------------------------------------#
if data.find ( 'Welcome' ) != -1:
Join(homechan)
if data.find ( 'PING' ) != -1:
irc.send ( 'PONG ' + data.split() [ 1 ] + '\r\n' )
#--------------------------- Action check --------------------------------#
if data.find('#') != -1:
action = data.split('#')[0]
action = action.split(' ')[1]
if data.find('NICK') != -1:
if data.find('#') == -1:
action = 'NICK'
#----------------------------- Actions -----------------------------------#
if action != 'none':
if action == 'PRIVMSG':
if data.find('$') != -1:
x = data.split('#')[1]
x = x.split('$')[1]
info = x.split(' ')
info[0] = info[0].strip(' \t\n\r')
send("err")
if action == 'JOIN':
Host = GetHost(data)
chan = GetChannel(data)
nick = GetNick(data)
Send("Hello " + nick +"! Welcome to " + chan + ".")
\ No newline at end of file
#N canvas 160 20 681 645 10;
#X declare -lib mrpeach;
#X declare -lib moocow -lib ratts-0.08;
#X declare -lib ratts;
#X msg 70 6 status;
#X msg 138 28 port 6667;
#X msg 138 5 port 5005;
#X obj 371 9 import mrpeach;
#X obj 70 56 udpreceive 5005;
#X obj 70 87 bytes2any 128 32;
#X obj 70 111 route bang;
#X obj 233 586 dac~;
#X text 44 379 Klatt formant synthesizer;
#X obj 127 362 klatt~ mspf 10;
#X obj 233 282 metro 10;
#X obj 127 212 guessphones;
#X obj 127 336 holmes;
#X obj 127 237 phones2holmes;
#X obj 233 261 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 372 33 import moocow ratts-0.08;
#X msg 547 202 \; pd dsp 1;
#X msg 547 235 \; pd dsp 0;
#X obj 547 180 loadbang;
#X obj 348 162 rattstok;
#X obj 348 216 guessphones;
#X obj 348 244 phones2holmes f;
#X obj 363 189 number2text;
#X obj 370 76 ratts;
#X obj 127 161 rattstok;
#X obj 142 188 number2text;
#X obj 349 443 *~;
#X obj 128 439 *~;
#X obj 367 409 hsl 128 15 0 1 0 0 empty empty VOLUME 5 8 0 10 -262144
-1 -1 0 1;
#X msg 233 240 1;
#X obj 348 346 holmes f0decl 10 topc 15.1 basec 0;
#X obj 348 370 klatt~ mspf 10;
#X obj 371 55 import ratts;
#X msg 416 510 0.43.1-extended-20120404;
#X text 415 492 test -> pd-version :;
#X text 413 533 lib mrpeach \, moocow \, ratts;
#X text 412 549 run python script speechpoetbot.py;
#X connect 0 0 4 0;
#X connect 1 0 4 0;
#X connect 2 0 4 0;
#X connect 4 0 5 0;
#X connect 5 0 6 0;
#X connect 6 1 24 0;
#X connect 6 1 19 0;
#X connect 9 0 27 0;
#X connect 10 0 12 0;
#X connect 10 0 30 0;
#X connect 11 0 13 0;
#X connect 11 0 29 0;
#X connect 12 0 9 0;
#X connect 13 0 12 0;
#X connect 14 0 10 0;
#X connect 18 0 16 0;
#X connect 19 0 20 0;
#X connect 19 1 22 0;
#X connect 19 2 20 0;
#X connect 20 0 21 0;
#X connect 21 0 30 0;
#X connect 22 0 20 0;
#X connect 24 0 11 0;
#X connect 24 1 25 0;
#X connect 24 2 11 0;
#X connect 25 0 11 0;
#X connect 26 0 7 1;
#X connect 26 0 7 0;
#X connect 27 0 7 0;
#X connect 27 0 7 1;
#X connect 28 0 26 1;
#X connect 28 0 27 1;
#X connect 29 0 14 0;
#X connect 30 0 31 0;
#X connect 31 0 26 0;
# see and test with speechpoetbot.pd
import irc.bot
import time
import datetime
import os
#------------------------------UDP-------------------------------#
import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 5005
#------------------------------UDP-------------------------------#
class monk(irc.bot.SingleServerIRCBot):
def __init__(self, channel, nickname, server, port=6667):
......@@ -18,11 +28,11 @@ class monk(irc.bot.SingleServerIRCBot):
def on_pubmsg(self, c, e):
s = e.arguments[0]
print type(s), s
f = open('minimalmonk.txt', 'a')
f.write(s + ' ')
#writing on a local file (same directory as the bot) minimalmonk.txt without lines or time or nick
#------------------------------UDP-------------------------------#
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.sendto(s, (UDP_IP, UDP_PORT))
#------------------------------UDP-------------------------------#
def on_welcome(self, c, e):
print "Bot connected"
......
......@@ -23,16 +23,8 @@ class HelloBot(irc.bot.SingleServerIRCBot):
print "*", e.arguments
msg = e.arguments[0]
sleep(randint(1, 5))
if msg.find("name")>=0:
print "ok"
c.privmsg(self.channel, "youhoubot")
c.privmsg(self.channel, "HAHAHA, I got you "+e.source.nick)
else:
print "no"
directory = "//home/relearn/relearn/new_babylon/txt/new_babylon/"
randomText = random.choice(os.listdir(directory))
line = random.choice(open(directory+randomText).readlines())
c.privmsg(self.channel, line)
c.privmsg(self.channel, "I love you "+e.source.nick)
......
......@@ -17,6 +17,7 @@ class PlotBot(irc.bot.SingleServerIRCBot):
self.on_pubmsg(c, e)
def on_pubmsg(self, c, e):
msg = e.arguments[0].decode("utf-8")
if msg.find("?")>=0:
......
......@@ -96,3 +96,8 @@ def two():
xs = angles(steps, rotations)
p(xs, lambda angle: 0.1 + 0.7 * math.cos(angle/rotations))
def spiral(xmin, ymin, xmax, ymax, rotations):
all_coordinates = xmin, ymin, xmax, ymax
f = lambda a: a / rotations / (2 * math.pi)
return compose_centered_plot(all_coordinates, angles(180, rotations), f)
import math
import nose.tools as n
import polar
def test_compose():
rotations = 2
observed = polar.compose_centered_plot((1000,2000,1400,3300), polar.angles(4, rotations), lambda a: a / rotations / (2 * math.pi))
expected = 'PU;PD200,650,200,675,150,650,200,575,300,650,200,775,50,650,199,475;'
n.assert_equal(observed, expected)
def test_spiral():
observed = polar.spiral(1000,2000,1400,3300, 20)
expected = ''
n.assert_equal(observed, expected)
......@@ -10,38 +10,41 @@ class ReportPlotBot(irc.bot.SingleServerIRCBot):
def on_welcome(self, c, e):
print "Bot connected"
c.join(self. observechannel)
c.join(self.observechannel)
c.join(self.plotchannel)
c.privmsg(self.observechannel, "Your activity is now being plotted in circles!")
def on_privmsg(self, c, e):
self.on_pubmsg(c, e)
def on_pubmsg(self, c, e):
#this change the precision of the circle
NbUsers = len(self.channels[e.target].users())
angle=360/(NbUsers/2)
#choose a random position
pX=randint(0,10000)
pY=randint(0,10000)
if e.target == self.observechannel:
msg = e.arguments[0]
#this count the length of a message and draws a circle accordingly
#msg = e.arguments[0]
#count = len(msg)
#size = min(count*100, 3000)
#todo='PA3000,5000;CI{0}'.format(wordcount)+','+str(angle)
#c.privmsg(self.plotchannel,str(todo))
NbWords = len(msg.split())
d=50
for x in range(0,NbWords):
cl='PA'+str(pX)+','+str(pY)+';CI{0}'.format((d*x)+d)+','+str(angle)
print cl
c.privmsg(self.plotchannel,str(cl))
posN=(NbWords*d)+20
nick = 'PR'+str(posN)+'LB'+e.source.nick
c.privmsg(self.plotchannel, 'DT*,1;LB{0}*'.format(nick))
#this change the precision of the circle
NbUsers = len(self.channels[e.target].users())
#rng=1+(randint(0,100) * .01)
rng=randint(1,7)
angle=360/(NbUsers/rng)
#choose a random position
pX=randint(0,16158)
pY=randint(0,11040)
if e.target == self.observechannel:
msg = e.arguments[0]
#this count the length of a message and draws a circle accordingly
#msg = e.arguments[0]
#count = len(msg)
#size = min(count*100, 3000)
#todo='PA3000,5000;CI{0}'.format(wordcount)+','+str(angle)
#c.privmsg(self.plotchannel,str(todo))
NbWords = len(msg.split())
d=50
for x in range(0,NbWords):
cl='PA'+str(pX)+','+str(pY)+';CI{0}'.format((d*x)+d)+','+str(angle)
print cl
c.privmsg(self.plotchannel,str(cl))
posN=(NbWords*d)+20
pos = 'PR{0},{0}'.format(posN)
c.privmsg(self.plotchannel, 'DT*,1;SI0.15,0.2;{0};LB{1}*'.format(pos,e.source.nick))
def on_join(self, c, e):
if e.target == self.observechannel:
......
osp.work.balsamine.2014-2015 @ 47477336
Subproject commit 4747733675584dc592a786379f35337a6b2d1b33
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment