Skip to content

Instantly share code, notes, and snippets.

View titouanc's full-sized avatar

iTitou titouanc

  • Belgium
View GitHub Profile
@titouanc
titouanc / matrice.py
Created November 15, 2012 13:19
Evolution de la matrice S lors de aes_decode - ULB: INFO-F-101::3 (2012-2013)
#juste avant la première passe de aes_decode
N0 = [[41, 8, 88, 72, 68, 63, 11, 69, 27, 57, 56, 15, 15, 85, 31, 95, 12, 15, 9, 87], [23, 97, 23, 59, 30, 8, 8, 42, 85, 67, 53, 64, 33, 49, 79, 21, 90, 32, 29, 74], [51, 94, 23, 69, 50, 61, 0, 61, 68, 39, 36, 26, 64, 39, 58, 85, 87, 10, 26, 80], [31, 19, 75, 59, 22, 87, 35, 1, 78, 84, 37, 29, 70, 65, 65, 30, 40, 78, 7, 24], [18, 96, 62, 81, 79, 42, 52, 42, 78, 26, 21, 27, 49, 80, 22, 27, 66, 64, 34, 5], [42, 90, 82, 87, 29, 5, 10, 82, 56, 72, 23, 29, 88, 69, 54, 51, 53, 51, 72, 91], [53, 92, 13, 20, 22, 97, 84, 53, 6, 94, 71, 30, 75, 40, 44, 49, 88, 57, 87, 83], [82, 68, 7, 66, 65, 42, 34, 8, 26, 52, 26, 83, 30, 35, 96, 37, 33, 20, 68, 37], [20, 76, 49, 85, 5, 28, 99, 21, 95, 96, 6, 5, 42, 25, 67, 17, 82, 81, 62, 88], [7, 57, 1, 92, 84, 7, 89, 23, 61, 84, 61, 61, 27, 79, 44, 1, 91, 96, 18, 99], [32, 21, 88, 8, 94, 23, 5, 90, 31, 72, 21, 3, 99, 69, 23, 61, 86, 92, 90, 85], [83, 92, 23, 96, 18, 26, 24, 95, 93, 52, 51, 89, 17, 23, 92, 35, 81, 68, 15, 86], [16, 42, 1,
@titouanc
titouanc / chemins.py
Created November 28, 2012 13:25
ULB - INFO-F-101: Projet4
CHEMINS = {('Ariel', 'Denise'): [], ('Adrien', 'Benoit'): ['Bertrand', 'Christian'], ('Bertrand', 'Genevieve'): ['Emile', 'Denise'], ('Bertrand', 'Helene'): ['Christian'], ('Camille', 'Helene'): ['Emile', 'Denise'], ('Cecile', 'Genevieve'): ['Christian', 'Adrien', 'Denise'], ('Gabriel', 'Claude'): ['Camille', 'Emile', 'Adrien', 'Bertrand'], ('Benoit', 'Gabriel'): ['Gilles'], ('Emile', 'Adele'): ['Adrien', 'Bertrand', 'Christian', 'Benoit', 'Gilles'], ('Benoit', 'Adrien'): [], ('Ariel', 'Bertrand'): ['Denise', 'Emile', 'Adrien'], ('Emile', 'Helene'): ['Denise'], ('Cecile', 'Adele'): ['Christian', 'Benoit', 'Gilles'], ('Adrien', 'Emile'): [], ('Benoit', 'Didier'): [], ('Bertrand', 'Denise'): ['Emile'], ('Benoit', 'Genevieve'): ['Gilles', 'Camille'], ('Christian', 'Genevieve'): ['Adrien', 'Denise'], ('Christian', 'Adrien'): [], ('Denise', 'Bertrand'): ['Emile', 'Adrien'], ('Christian', 'Claude'): ['Bertrand'], ('Gabriel', 'Camille'): [], ('Emile', 'Bernadette'): ['Adrien', 'Bertrand', 'Christian', 'Benoit', 'Gil
@titouanc
titouanc / cpuinfo
Created December 2, 2012 16:57
HP 530 SFF
processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 2
model name : Intel(R) Pentium(R) 4 CPU 2.80GHz
stepping : 9
cpu MHz : 2793.207
cache size : 512 KB
physical id : 0
siblings : 2
#Construction des chemins a partir d'un chemin et d'une relation:
# (A, B):[M, N] et B:(D) => (A, D):[M, N, B]
RELATIONS = {
A : (B),
B : (C, D)
}
CHEMINS = {
(A, B) : [],
@titouanc
titouanc / output-1.txt
Created December 10, 2012 21:20
INFO-F-102 - Projet: exemple d'exécution
$ yes | python simulateur.py prog.txt
PC: 2 | CYCLES: 1
REGISTERS |R0 |R1 |R2 |R3 |R4 |R5 |R6 |R7 |R8 |R9 |
LOCKED | | | | | | | | | | |
PIPELINE 0
IF: LOAD R1, 10 (1)
ID: NOP (0)
EX: NOP (0)
MEM: NOP (0)
WB: NOP (0)
@titouanc
titouanc / chap4-exercice6.py
Last active December 10, 2015 08:19
INFO-F-101: Exercices Chapitre4: TurtleWorld
from math import pi
from swampy.TurtleWorld import TurtleWorld, Turtle
def arc(turtle, r, angle=360):
"""Trace un arc de cercle de rayon r."""
l = 2*pi*r
for i in range(angle):
turtle.fd(l/360)
turtle.lt(1)
@titouanc
titouanc / except.py
Last active December 10, 2015 16:28 — forked from anonymous/except.py
#pas besoin de redéfinir les méthodes __init__ et __repr__ puisqu'elles sont déjà définies dans Exception
class ErrDeg(Exception) :
pass
#Ou alors pour leur donner un fonctionnement supplémentaire
class ErrDeg(Exception):
def __init__(self, deg1, deg2):
self.value = str(deg1)+" != "+str(deg2)
@titouanc
titouanc / <3.rb
Last active December 10, 2015 17:58
Dire "je t'aime en Ruby" (check)
class I
class << self
def love someone
puts "#{self} love #{someone}"
end
end
end
class You
attr :marvellous
@titouanc
titouanc / banque.py
Last active December 11, 2015 00:48
class Compte(object):
"""Represente un compte en banque"""
EUROS_PAR_DOLLAR = 0.8447
def __init__(self):
"""Renvoie un nouveau compte"""
self.solde = 0.0
def getSolde(self):
class ClasseA:
def __init__(self, prenom):
self.prenom = str(prenom)
def getPrenom(self):
return self.prenom
def hello(self):
print("Salut, je suis A "+self.getPrenom())