Skip to content

Instantly share code, notes, and snippets.

View habibutsu's full-sized avatar

Alexander Verbitsky habibutsu

View GitHub Profile
@habibutsu
habibutsu / app.py
Created January 3, 2023 03:08
Raster-service
import logging
import time
import mercantile
import io
import numpy as np
from shapely.ops import transform
from pyproj.transformer import Transformer
from shapely.geometry import box
@habibutsu
habibutsu / sample.py
Created April 8, 2021 20:13
type hints
from typing import Callable, TypeVar, cast, Generic
class SomeRequest:
pass
class SomeResponse:
pass
@habibutsu
habibutsu / cancel_long_running_task.py
Created May 6, 2020 18:05
Dask - distributed computation
import asyncio
import logging
import sys
import socket
import time
from contextlib import closing
try:
from contextlib import asynccontextmanager
except ImportError:
@habibutsu
habibutsu / json_formatter.py
Created April 15, 2020 16:18
Json formatter for python logger
import logging
import traceback
try:
import ujson as json
except ImportError:
import json
class JsonFormatter(logging.Formatter):
@habibutsu
habibutsu / notes.md
Last active November 9, 2023 10:29
ETL frameworks

Distributed computation

Libraries:

@habibutsu
habibutsu / libraries.md
Last active September 10, 2019 10:36
barcode, qr-code

Comercial SDK

@habibutsu
habibutsu / python_memory_management.md
Last active September 6, 2019 13:44
Управление памятью в питоне

Управление памятью в Python

Организация памяти

Память в Python организована в несколько уровней.

  • Слой 3 (Уровень ядра) - предназначен для non-object данных самого интерпрeтатора
  • Слой 2 - выделение памяти под объекты
  • Слой 1 - PyMem_ API
@habibutsu
habibutsu / remote_file.py
Created May 31, 2019 15:30
Reading remote file through http
import io
from http import HTTPStatus
from urllib.request import Request, urlopen
from urllib.error import HTTPError
class RemoteFile(io.IOBase):
'''
Example of usage
@habibutsu
habibutsu / bulbacon_test.py
Created January 31, 2019 11:01
Solution of bulbacon's task (https://goo.gl/cCqrJw)
import itertools
import random
import sys
import operator
import functools
import types
import math
import numpy as np