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
#include <iostream> | |
#include <sstream> | |
#include <cstdint> | |
#include <cstddef> | |
#include <string> | |
#include <memory> | |
#include <vector> | |
#include <tuple> | |
#include <utility> | |
#include <type_traits> |
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
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 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 threading | |
MAPPINGS = { | |
"&" : "&", | |
"'" : "'", | |
'"' : """, | |
"<" : "<", | |
">" : ">", | |
} |
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 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 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
>>> x="" | |
>>> for i in range(25): | |
... print i, len(x) | |
... x = repr(x) | |
... | |
0 0 | |
1 2 | |
2 4 | |
3 8 | |
4 16 |
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
# | |
# By Nimrod Aviram and Eyal Lotem | |
# | |
import functools | |
class TailCallFunc(object): | |
def __init__(self, func): | |
self.func = func |
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
{-# LANGUAGE ScopedTypeVariables #-} | |
--module Construct where | |
import Prelude hiding (const, repeat) | |
import Data.Int (Int8, Int16, Int32, Int64) | |
import Data.Word (Word8, Word16, Word32, Word64) | |
import qualified Data.ByteString.Lazy as LBS | |
import qualified Data.Binary as BIN | |
import Data.Bits (Bits, bitSize, shiftR) |
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
from utils import singleton | |
from monads import monadic, MonadRunner | |
class Text(object): | |
def __init__(self, text): | |
self.text = text | |
class Input(object): | |
def __init__(self, label): | |
self.label = label |
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
o | |
(s | |
); | |
P(c); | |
N();; | |
exe(p); // | |
typedef //u | |
/*jj>*/ /*op | |
*/ unsigned char | |
nf ; main(){ char ch[ |
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
{- learning haskell by "porting" Construct from python -} | |
import Data.Int | |
import Data.Word | |
import qualified Data.ByteString.Lazy as LBS | |
import Data.Char | |
import Control.Monad | |
import Data.Binary.Get | |
data Packer t = Packer { |
NewerOlder