This file contains 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
#include <memory> | |
#include <iostream> | |
#include <type_traits> | |
#include <tuple> | |
#include <vector> | |
/* | |
* seq<> and gen<> are used to call function with arguments saved as a tuple | |
*/ | |
template<int...> |
This file contains 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
-- here's the function used to actually drag & reorder tags | |
local function tag_drag(t) | |
local dr = mywibox[1]._drawable | |
mousegrabber.run(function (_mouse) | |
for k, v in ipairs(_mouse.buttons) do | |
if v then | |
local x = _mouse.x | |
local y = _mouse.y |
This file contains 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
#!/usr/bin/env python | |
import json | |
import sys | |
def list_duplicates(seq): | |
seen = set() | |
seen_add = seen.add | |
# adds all elements it doesn't know yet to seen and all other to seen_twice |
This file contains 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
from __future__ import ... |
This file contains 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 SocketServer | |
SocketServer.TCPServer.allow_reuse_address = True | |
class PingHandler(SocketServer.StreamRequestHandler): | |
""" | |
Simple ping service. | |
Dziedziczysz po StreamRequestHandler i potem mozesz robic | |
self.rfile.readline(). |
This file contains 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
def singleton(cls): | |
instances = {} | |
def getinstance(): | |
if cls not in instances: | |
instances[cls] = cls() | |
return instances[cls] | |
return getinstance | |
@singleton | |
class MyClass: |
This file contains 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
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 | |
{ |
This file contains 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
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): |
This file contains 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
#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) |
This file contains 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
#include <iostream> | |
namespace ns1 { | |
template <typename T, typename U> | |
int operator+(const T&, const U&) | |
{ | |
std::cout << "ns1::operator+" << std::endl; | |
return 1; | |
} |
OlderNewer