Skip to content

Instantly share code, notes, and snippets.

@bussiere
bussiere / randomdigit.py
Created March 14, 2012 16:49
Random digit generator with 0 at the beginning
import random
def randomdig(number):
max = "9"*number
max = int(max)
rand = random.randint(0,max)
rand = str(rand)
rand = "0"*(number-len(rand))+rand
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@bussiere
bussiere / Le_Loop.py
Created March 17, 2012 17:35
Bot twitter pour le loop
#!/usr/bin/env python
# -*- coding: utf8 -*-
# Copyright (c) 2012, Valentin Lorentz
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
@bussiere
bussiere / Graphe.py
Created March 18, 2012 12:46
Graph in python
import threading
class Graph:
def __init__(self,name):
self.name = name
self.list_neighbor = {}
self.list_node = {}
def add_node(self,node):
self.list_node[node] = True
@bussiere
bussiere / lieuxjackoint.py
Created March 19, 2012 22:08
lieux jackpoint
from datetime import datetime
from couchdbkit.ext.django.schema import *
# Create your models here.
class Avis(Document):
Texte= StringProperty()
Membre_membre_Membre= ListProperty()
Publiable= BooleanProperty()
Lien_lien_Lien= ListProperty()
@bussiere
bussiere / annonce.txt
Created March 22, 2012 15:48
annonce du loop
Le Telecomix Crypto Munitions Buro (aka TCMB) vous invite à un Chaos
Crypto Workshop sur les darknets.
Nous ne parlerons pas de Tor, d'OTR et de GPG parce que je commence à en
avoir un peu marre et que j'ai envie de faire quelque chose (et que rien
ne vous empêche do'rganiser des ateliers sur ces thématiques, c'est un
excellent moyen d'apprendre).
Et, pour une fois, j'ai envie qu'on fasse quelque chose plus haut
niveau. Donc, on va se construire un darknet et y mettre les premières
@bussiere
bussiere / test.py
Created March 23, 2012 10:12
invalid syntax
# -*- coding: utf-8 -*-
def ensurefirstuser(firstname,lastname,email,password)​:
users = db(db.auth_user.email==email).​select()
if users:
user_id = users[0].id
created = False
if settings.debug_ensure_first_​user == True:
print ('found user_id so created equals %s') % created
return (user_id,created)
@bussiere
bussiere / fuckinglogin.py
Created March 25, 2012 00:56
funcking login
password="toto"
my_crypt = CRYPT(key=auth.settings.hmac_key)
crypt_pass = my_crypt(password)[0]
user = db.auth_user.insert(
Surnom="Surnom",
email="email",
password=crypt_pass,
)
db.commit()
session.auth = Storage(user=user,expiration=auth.settings.expiration,hmac_key=str(uuid4()))
@bussiere
bussiere / dbauth.py
Created March 25, 2012 01:17
db utah redefined
db.define_table(
auth.settings.table_user_name,
Field('Surnom', length=128, default=''),
Field('email', length=128, default='', unique=True), # required
Field('password', 'password', length=512,# required
readable=False, label='Password'),
Field('Skills','list:reference SkillUser',default=None),
Field('Items','list:reference Item',default=None),
Field('registration_key', length=512,# required
writable=False, readable=False, default=''),
@bussiere
bussiere / athfuckfuck.py
Created March 25, 2012 11:18
fucking auth still doesn't <work
password="toto"
my_crypt = CRYPT(key=auth.settings.hmac_key)
crypt_pass = my_crypt(password)[0]
user = db.auth_user.insert(
Surnom="Surnom",
email="email5@toto",
username="titi",
password=crypt_pass,
)
db.commit()