Skip to content

Instantly share code, notes, and snippets.

View ramazanpolat's full-sized avatar

Ramazan Polat ramazanpolat

View GitHub Profile
@ycd
ycd / kafka_logger.py
Created February 2, 2021 23:10
async logger for kafka
import logging
import json
import asyncio
from typing import Dict, Any
from threading import Thread
import confluent_kafka
from confluent_kafka.cimpl import KafkaException
@den-crane
den-crane / NullableVsInt.sql
Created March 11, 2020 00:43
NullableVsInt
Denny Crane [not a Yandex bot], [Mar 10, 2020 at 6:34:43 PM (2020-03-10, 6:34:50 PM)]:
create table XXN (A Int64, B Nullable(Int64)) Engine=MergeTree order by tuple()
insert into XXN select 45545645, null from numbers(100000000);
select column, formatReadableSize(sum(column_bytes_on_disk)) bytes_on_disk, formatReadableSize(sum(column_data_uncompressed_bytes)) uncompressed
from system.parts_columns
where active = 1 and table like '%XXN%'
group by database,table, column
Serial Keys:
FU512-2DG1H-M85QZ-U7Z5T-PY8ZD
CU3MA-2LG1N-48EGQ-9GNGZ-QG0UD
GV7N2-DQZ00-4897Y-27ZNX-NV0TD
YZ718-4REEQ-08DHQ-JNYQC-ZQRD0
GZ3N0-6CX0L-H80UP-FPM59-NKAD4
YY31H-6EYEJ-480VZ-VXXZC-QF2E0
ZG51K-25FE1-H81ZP-95XGT-WV2C0
VG30H-2AX11-H88FQ-CQXGZ-M6AY4
@den-crane
den-crane / AggregatingMergeTree-event-enrichment
Last active September 7, 2023 17:32
AggregatingMergeTree-event-enrichment
CREATE TABLE states_raw(
d date,
uid UInt64,
first_name String,
last_name String,
modification_timestamp_mcs DateTime64(3) default now64(3)
) ENGINE = Null;
CREATE TABLE final_states_by_month(
d date,
@androiddrew
androiddrew / apistar_forms.py
Created May 19, 2018 17:29
Re-implementing the Multi-part Form Parser in APIStar >= 0.4
import io
import typing
from apistar import Component, http
from apistar.server.wsgi import WSGIEnviron
from werkzeug.datastructures import ImmutableMultiDict
from werkzeug.formparser import FormDataParser
from werkzeug.http import parse_options_header
from werkzeug.wsgi import get_input_stream
RequestStream = typing.NewType('RequestStream', io.BufferedIOBase)
@sanchezzzhak
sanchezzzhak / clickhouse-get-tables-size.sql
Created January 18, 2018 13:43
clickhouse get tables size
SELECT table,
formatReadableSize(sum(bytes)) as size,
min(min_date) as min_date,
max(max_date) as max_date
FROM system.parts
WHERE active
GROUP BY table
@tgwizard
tgwizard / flask_file_streamer.py
Last active July 1, 2020 21:34
A Flask request multipart/form-data file streamer
import time
import werkzeug.formparser
from flask import Flask, Response, request
class DummyWerkzeugFile:
def write(self, b: bytes):
print('reading file parts: size=%s' % len(b))
@learncodeacademy
learncodeacademy / webpack.config.js
Created January 8, 2016 03:55
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"