Skip to content

Instantly share code, notes, and snippets.

import SocketServer
SocketServer.TCPServer.allow_reuse_address = True
class PingHandler(SocketServer.StreamRequestHandler):
"""
Simple ping service.
Dziedziczysz po StreamRequestHandler i potem mozesz robic
self.rfile.readline().
def singleton(cls):
instances = {}
def getinstance():
if cls not in instances:
instances[cls] = cls()
return instances[cls]
return getinstance
@singleton
class MyClass:
TODO: reprezentacja krawędzi w model i network musi umożliwiać jednoznaczne
mapowanie portów. Jak nazwać krawędzie? Czy wprowadzić porty już w
konfiguracji model?
TODO: a jak w model przedstawić port, w sytuacji, kiedy trzeba na nim założyć
jakąś konfigurację (np. packet-loss).
#v+
model Foo
{
def read(self, model, network, mapping, schedule):
# local variables for each configuration file
ctx_model = {}
ctx_network = {}
ctx_mapping = {}
ctx_schedule = {}
# resources can be defined in any configuration part
glob_resources = Resources.public_functions
def setup_glob(module):
#include <iostream>
#include <string>
template <typename T, typename T_Infix>
struct InfixProxy {
T const & lhs_;
T_Infix const & oper_;
InfixProxy(T const & lhs, T_Infix const & oper)
: lhs_(lhs), oper_(oper)
#include <iostream>
namespace ns1 {
template <typename T, typename U>
int operator+(const T&, const U&)
{
std::cout << "ns1::operator+" << std::endl;
return 1;
}
\documentclass[00-praca-magisterska.tex]{subfiles}
\begin{document}
\chapter{Moduł Arete Master}
Prezentujemy tutaj szczegółowy opis modułu Master. Jest to moduł zarządzający
definicją i wykonywaniem testów. Jest on też interfejsem użytkownika do naszego
narzędzia -- za jego pomocą użytkownik wykonuje testy.
@qsorix
qsorix / hanoi-1.hs
Created February 9, 2012 22:12
Towers of Hanoi in Haskell, part I
type Disc = Int
type Tower = [Disc]
data Towers = Towers
{ towerA :: Tower
, towerB :: Tower
, towerC :: Tower
} deriving (Show)
data TowerName = A | B | C
deriving (Show)
@qsorix
qsorix / hanoi-2.hs
Created February 13, 2012 18:20
Towers of Hanoi in Haskell, part II
import Control.Monad.State
type Disc = Int
type Tower = [Disc]
data Towers = Towers
{ towerA :: Tower
, towerB :: Tower
, towerC :: Tower
} deriving (Show)
@qsorix
qsorix / hanoi-3.hs
Created February 18, 2012 21:38
Tower of Hanoi in Haskell, part 3
import Control.Monad.State
type Disc = Int
type Tower = [Disc]
data Towers = Towers
{ towerA :: Tower
, towerB :: Tower
, towerC :: Tower
} deriving (Show)