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
VlanTagOrType = Struct("VlanTagOrType", | |
Enum(UBInt16("type"), | |
IPv4 = 0x0800, | |
ARP = 0x0806, | |
RARP = 0x8035, | |
X25 = 0x0805, | |
IPX = 0x8137, | |
IPv6 = 0x86DD, | |
VLAN_TAG = 0x8100, | |
_default_ = Pass, |
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 <sstream> | |
#include <cstdint> | |
#include <cstddef> | |
#include <string> | |
#include <memory> | |
#include <vector> | |
#include <tuple> | |
#include <utility> | |
#include <type_traits> |
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 numpy as np | |
import bottleneck as bn | |
def top_n_indexes(arr, n): | |
idx = bn.argpartsort(arr, arr.size-n, axis=None)[-n:] | |
width = arr.shape[1] | |
return [divmod(i, width) for i in idx] | |
np.random.seed(47) |
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 sys | |
from types import ModuleType | |
__path__ = [] | |
LAZY_PREFIX = "__lazy__" | |
class OnDemandModule(ModuleType): | |
def __init__(self, name): | |
ModuleType.__init__(self, name) | |
object.__setattr__(self, "__module", None) |
OlderNewer