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
SELECT | |
relname AS "relation", | |
C .reltuples::bigint AS approximate_rows, | |
pg_size_pretty ( | |
pg_total_relation_size (C .oid) | |
) AS "data_size", | |
pg_size_pretty ( | |
pg_indexes_size(C .oid) | |
) as "indexes_size", | |
pg_size_pretty ( |
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
name: kafka-sandbox | |
services: | |
kafka: | |
image: bitnami/kafka:4.0.0 | |
environment: | |
- KAFKA_CLUSTER_ID=lkorDA4qT6W1K_dk0LHvtg | |
# Start Kraft Setup (Kafka as Controller - no Zookeeper) | |
- KAFKA_CFG_NODE_ID=1 | |
- KAFKA_CFG_PROCESS_ROLES=broker,controller | |
- KAFKA_CFG_BROKER_ID=1 |
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
pipeline { | |
agent { label "docker" } | |
stages { | |
stage("test sidecar") { | |
steps{ | |
script { | |
withDockerNetwork { n -> | |
// we could use Image.withRun() instead of Image.run(), | |
// and get rid of try/catch/finally blocks | |
// It's prefferable way, but it doesn't remove volumes after containers |
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 typing import ( | |
Generic, Optional, TYPE_CHECKING, | |
Type, TypeVar, Union, overload, | |
) | |
T = TypeVar("T", bound="A") # noqa | |
class Descr(Generic[T]): | |
@overload |
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 math | |
import signal | |
from concurrent.futures import ProcessPoolExecutor | |
from contextlib import suppress | |
from time import sleep | |
values = [40000000, 30000000, 20000000, 10000000] | |
PRIMES = [ | |
112272535095293, |
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 typing import Dict, Any, List | |
import abc | |
class Repository(abc.ABC): | |
def __init__(self, model): | |
self.model = model # or connection pool | |
def create_one(self, data: Dict[str, Any]): | |
item = self.model.from_dict(data) |
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
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
from __future__ import print_function | |
from __future__ import absolute_import | |
import base64 | |
import pytest | |
import pytest_twisted |
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
# GDAL | |
sudo apt install gdal-bin libgdal-dev | |
pip install GDAL==$(gdal-config --version) --global-option=build_ext --global-option="-I/usr/include/gdal" | |
# MAPNIK | |
sudo apt install mapnik-utils libmapnik-dev libboost-all-dev | |
mapnik-config -v # check mapnik version | |
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 pprint | |
from collections import namedtuple | |
# fields names mapping | |
fields = { | |
"Название": "name", | |
"Сорт": "sort", | |
"Цена": "price", | |
"Картинка": "image", | |
} |
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 logging | |
import requests | |
# init simpliest custom logger | |
logger = logging.getLogger("myAwesomeLogger") | |
logger.setLevel(logging.DEBUG) | |
logger.addHandler(logging.StreamHandler()) |
NewerOlder