Skip to content

Instantly share code, notes, and snippets.

View raph-amiard's full-sized avatar

Raphaël AMIARD raph-amiard

View GitHub Profile
Initializing cgroup subsys cpuset
Linux version 2.6.27.10-grsec-xxxx-grs-ipv4-64 (root@kernel-64.ovh.net) (gcc version 4.3.2 (Debian 4.3.2-1) ) #7 SMP Wed Sep 9 22:07:04 UTC 2009
Command line: auto BOOT_IMAGE=Linux ro root=801
KERNEL supported cpus:
Intel GenuineIntel
AMD AuthenticAMD
Centaur CentaurHauls
BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
class Lion(object):
def run():
print "THIS LION IS RUNNING"
class Panthere(object):
def run():
print "THIS PANTHERE IS RUNNING"
animals = [Panthere(), Lion()]
@raph-amiard
raph-amiard / bellman_ford.py
Created November 17, 2010 19:48
Python implementation of the bellman ford shortest path algorithm
from functools import partial
INF = float('Inf')
# Utility functions
def change_state(graph, node, state=''):
graph.node[node]['state'] = state
def is_state_equal_to(graph, node, state=''):
return graph.node[node]['state'] == state
@raph-amiard
raph-amiard / filetree.py
Created December 12, 2010 11:28
file tree data structure
from os import walk
from os.path import basename, abspath, join
from time import time
class Node(object):
DIR = 1
FILE = 2
def __init__(self,type, value):
self.children = {}
@raph-amiard
raph-amiard / posterous_post_1.coffee
Created December 25, 2010 13:22
test coffeescript
func = (a=15, b=16) -> a + b
func(a=12)
@raph-amiard
raph-amiard / pppe1.py
Created December 25, 2010 13:24
posterous post python example 1
def func(a=15, b=20):
return a + b
func(a=12)
@raph-amiard
raph-amiard / pppe2.py
Created December 25, 2010 13:25
posterous post python example 2
def func(**kwargs):
for key, arg in kwargs:
print "key: ", key, "arg: ", arg
func(a=15, b= 12)
@raph-amiard
raph-amiard / ppce2.coffee
Created December 25, 2010 13:26
posterous post coffeescript example 2
func = (mmap) ->
for key, val of mmap
print "key: #{key}, val: #{val}"
func {a:15, b:12}
@raph-amiard
raph-amiard / pppe3.py
Created December 25, 2010 13:28
posterous post python example 3
def func1(c=30, d=50, **kwargs):
return c + d + func2(**kwargs)
def func2(a=15, b=10):
return a + b
func1(c=3, d=5)
func1(3, d=5, a = 40)
@raph-amiard
raph-amiard / ppce3.coffee
Created December 25, 2010 13:30
posterous post coffeescript example 3
func1 = (args={c:30, d:50}) ->
args.c + args.d + func2(args)
func2 = ({a, b}) ->
a = 15 if not a?
b = 10 if not b?
a + b
func1 {c:3, d:5}