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
WITH | |
all_tables AS | |
( | |
SELECT * | |
FROM ( | |
SELECT | |
'all' :: TEXT AS table_name, | |
sum((coalesce(heap_blks_read, 0) + | |
coalesce(idx_blks_read, 0) + | |
coalesce(toast_blks_read, 0) + |
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 java.io.File | |
import java.util.UUID | |
import org.apache.avro.Conversions.DecimalConversion | |
import org.apache.avro.Conversions.UUIDConversion | |
import org.apache.avro.Schema | |
import org.apache.avro.file.DataFileWriter | |
import org.apache.avro.generic.{GenericData, GenericRecord} | |
import org.apache.avro.io.DatumWriter |
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 fastavro import writer, reader | |
schema = { | |
'doc': 'A weather reading.', | |
'name': 'Weather', | |
'namespace': 'test', | |
'type': 'record', | |
'fields': [ | |
{'name': 'station', 'type': 'string'}, | |
{'name': 'time', 'type': 'long'}, |
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 interface import utils as iutils | |
from rest_framework import status | |
class PartnerViewSet(viewsets.ModelViewSet): | |
authentication_classes = (ValidatorOauthAuthentication, ) | |
queryset = im.Partner.objects.all() | |
serializer_class = PartnerSerializer | |
def create(self, request, *args, **kwargs): | |
partner_id, login, password = iutils.create_partner( |
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 -*- | |
# Generated by Django 1.10.6 on 2017-04-04 08:08 | |
from __future__ import unicode_literals | |
from django.db import migrations | |
# python manage.py dumpdata > dump.json | |
def load_fixture(apps, schema_editor): | |
from django.core.serializers import base, python | |
from django.core.management import call_command | |
# Save the old _get_model() function |
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=utf8 | |
import logging | |
import threading | |
import time | |
from django.core.management import call_command | |
from django.core.management.base import BaseCommand | |
logger = logging.getLogger('multirunner') |
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
version: '2' | |
services: | |
zookeeper-1: | |
image: confluentinc/cp-zookeeper:latest | |
restart: always | |
environment: | |
ZOOKEEPER_SERVER_ID: 1 | |
ZOOKEEPER_CLIENT_PORT: 2181 | |
ZOOKEEPER_TICK_TIME: 2000 | |
ZOOKEEPER_INIT_LIMIT: 5 |
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 confluent_kafka import Consumer, KafkaError | |
import signal | |
# корректное завршение по сигналам | |
canGo = True | |
def doStop(*args, **kwargs): | |
global canGo | |
canGo = False | |
signal.signal(signal.SIGINT, doStop) | |
signal.signal(signal.SIGTERM, doStop) |
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
число(что слал продюсер)-оффсет(смешение в партиции)-партиция | |
0-0-3 | |
1-0-2 | |
5-1-2 | |
7-2-2 | |
10-3-2 | |
6-1-3 | |
8-2-3 | |
9-3-3 | |
12-4-2 |
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
{"namespace": "sms.smsgate.rfi", | |
"type": "record", | |
"name": "SMS", | |
"fields": [ | |
{"name": "message", "type": "string"}, | |
{"name": "operator", "type": "string"}, | |
{"name": "date", "type": "string"} | |
] | |
} |