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 Network.Socket hiding (send, sendTo, recv, recvFrom) | |
import Network.Socket.ByteString | |
import Control.Concurrent | |
port = 4242 | |
incomingBufferSize = 4096 | |
main = do | |
-- Listen | |
sock <- socket AF_INET Stream 0 |
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 Network.Socket hiding (send, sendTo, recv, recvFrom) | |
import Network.Socket.ByteString | |
import Control.Concurrent | |
port = 4242 | |
incomingBufferSize = 4096 | |
delayMicroseconds = 500000 | |
main = do | |
-- Listen |
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 Control.Lens | |
import Control.Monad.Loops | |
import Control.Monad.State.Strict | |
import Data.List | |
import Data.List.Split | |
import Data.Maybe | |
data SudokuValue = S1 | S2 | S3 | S4 | S5 | S6 | S7 | S8 | S9 deriving (Eq, Enum) | |
instance Show SudokuValue where | |
show s = show $ fromJust (s `elemIndex` [S1 ..]) + 1 |
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 asyncio | |
import os | |
import aiohttp | |
from aws_sig_v4_headers import aws_sig_v4_headers | |
async def main(): | |
method = 'PUT' | |
host = 's3-eu-west-1.amazonaws.com' |
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 asyncio | |
import contextlib | |
class PathLock(): | |
def __init__(self): | |
self.lock = asyncio.Lock() | |
@contextlib.asynccontextmanager | |
async def __call__(self, read, write): |
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 asyncio | |
import contextlib | |
import weakref | |
from fifolock import FifoLock | |
class ReadAncestor(asyncio.Future): | |
@staticmethod | |
def is_compatible(holds): | |
return not holds[Write] |
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 asyncio | |
import contextlib | |
import weakref | |
from fifolock import FifoLock | |
class Read(asyncio.Future): | |
@staticmethod | |
def is_compatible(holds): | |
return not holds[Write] |
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 asyncio | |
import contextlib | |
from fifolock import FifoLock | |
class Read(asyncio.Future): | |
@staticmethod | |
def is_compatible(holds): | |
return not holds[Write] |
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 ctypes import ( | |
byref, | |
c_char_p, c_uint32, c_uint16, c_ubyte, | |
CDLL, | |
POINTER, | |
pointer, | |
Structure, Union, | |
sizeof, | |
) | |
import platform |
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 csv | |
import logging | |
import gevent | |
from psycopg2 import ( | |
connect, | |
sql, | |
) | |
from django.conf import ( |
OlderNewer