Skip to content

Instantly share code, notes, and snippets.

View constverum's full-sized avatar

Denis constverum

  • Independent contractor
  • Russia
View GitHub Profile
@constverum
constverum / external_merge_sort.py
Created June 27, 2017 16:32
External merge sort
import array
import heapq
import sys
import tempfile
class ExternalMergeSort:
MAX_INTS_PARTION = 10000 # reads/writes up to N integers at a time
@constverum
constverum / async_test.py
Created January 19, 2016 18:41
Example of async test
import asyncio
import aiohttp
import unittest
from unittest import mock
async def get_my_ip(timeout=3, loop=None):
try:
with aiohttp.Timeout(timeout, loop=loop):
with aiohttp.ClientSession(loop=loop) as session:
async with session.get('http://httpbin.org/get?show_env') as resp: