Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python2.6
#
# Riff, rock, and much more !!
#
# Copyright 2008 Antoine Millet <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#!/usr/bin/env python
#coding=utf8
import os
import sys
import copy
from random import randint
import pygame; pygame.init()
from pygame.locals import *
#!/usr/bin/env python
#coding=utf8
# PTI #5
import pickle
import fcntl
USER_DATABASE = 'users.db'
class User(object):
>>> l
[(1, 1, 4), (3, 1, 11), (2, 1, 13), (6, 1, 17), (5, 1, 17), (4, 1, 18), (2, 2, 28), (1, 2, 29), (3, 2, 30), (4, 2, 31), (5, 2, 31), (6, 2, 33), (1, 3, 45), (3, 3, 51)]
>>> d = {}
>>> for x in l:
... if x[0] in d:
... if x[1] > d[x[0]][0]:
... d[x[0]] = x[1:]
... else:
... d[x[0]] = x[1:]
...
#!/usr/bin/env python
#coding=utf8
import sys
import time
import re
from subprocess import Popen, PIPE
from arprequest import ArpRequest
import arprequest
Const reading = 1
Const writing = 2
set wmi_service = getobject("winmgmts:" & "{impersonationLevel=impersonate}!\\"& strComputer &"\root\cimv2")
set processes = wmi_service.execquery("select * from Win32_Process")
#!/usr/bin/env python
#coding=utf8
from automatelib import State, Transition, Automaton, EpsilonTransition
if __name__ == '__main__':
# Automate de test acceptant l'alphabet {a, b, c} et dont les mots
# commencent et finissent forcément par a.
#~ s1 = State('1')
#!/usr/bin/env python
#coding=utf8
'''
Lala
'''
class State(object):
''' Représente un état de l'automate. '''
@NaPs
NaPs / df.py
Created December 8, 2009 23:42
#!/usr/bin/env python
# coding=utf8
import subprocess
from graphit.client import GraphItAgent
# Parameters :
mountpoint = '/mnt/data'
w='on the wall'
b=lambda x:'%d bottle%s of beer'%(x,'s'*(x>1))
v,p,n=',.\n'
def z(a='Take one down and pass it around',o=1):print b(i),w+v,b(i)+p+n,a+v,b((i-o)%100),w+p+n
i=99
while i>1:z();i-=1
z('Go to the store and buy some more',2)