This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Implementation of state design pattern for MLD router state transition | |
* (RFC 2710) using C | |
*/ | |
#include <stdio.h> | |
#include <stdbool.h> | |
struct mld_state { | |
struct mld_ctx * ctx; | |
void (*init)(struct mld_state *, struct mld_ctx *); | |
void (*recv_query)(struct mld_state *, bool lower); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#implementation of state design pattern for MLD router state transition | |
#(RFC2710) | |
import time | |
class NonQuerier: | |
def __init__(self, ctx): | |
print "In non-querier" | |
print "Start other querier timeout" | |
self.ctx = ctx | |
self.timeout = time.time() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import shutil | |
class chroot: | |
def __init__(self, root_dir): | |
self.root_dir = root_dir | |
def __enter__(self): | |
self.real_root = os.open("/",os.O_RDONLY) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
class cd: | |
def __init__(self, path): | |
print "constructor" | |
self.dest = path | |
self.origin = os.getcwd() | |
def __enter__(self): | |
os.chdir(self.dest) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Dirty and ugly hack to duplicate stdout stream to a file | |
Be careful as this only overwrites several file functions | |
This thing sort of acts like unix's tee program | |
Ang Way Chuang <[email protected]> | |
Feel free to use, modify and distribute. No warranty and no restriction | |
''' | |
import sys |
NewerOlder