Skip to content

Instantly share code, notes, and snippets.

View gam6itko's full-sized avatar
💭

Alexander Strizhak gam6itko

💭
  • Russia, Ryazan
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<rates>
<!-- общий пример -->
<item>
<!-- 1 WMZ на 30.593562 WMX -->
<from>WMZ</from>
<to>WMX</to>
<in>1</in>
<out>30.593562</out>
@gam6itko
gam6itko / rdkafka-batch-processing.md
Last active July 28, 2023 15:21
php rdkafka batch messages processing

php-rdkafka batch messages processing

This example shows how to process kafka messages in batches with php-rdkafka. As soon as the required number of messages appears in topic, they will be immediately processed.

The key Kafka Conf value to achieve proper behavior is enable.auto.offset.store=false. See here

Execute

PARTITION=0
@gam6itko
gam6itko / explode_vs_str_repeat.php
Created November 14, 2022 12:12
php batching sql query build performance
<?php
/**
* If you build SQL queries like INSERT INTO table ('f1', 'f2', ...) VALUES ('v1', 'v2', ...), ('v1', 'v2', ...), ...
* You should know what
*
* Expression
* `rtrim(str_repeat('?,', TRY_COUNT), ',');`
* works 16 time faster than
* `implode(',', array_pad([], TRY_COUNT, '?'));`
@gam6itko
gam6itko / gitlab-runner-install.yaml
Last active February 27, 2025 18:14
ansible community.general.gitlab_runner - Install and register gitlab group runner example
---
- name: Play gitlab-runner
hosts: all
tasks:
- name: Create a GitLab Runner user
user:
name: gitlab-runner
comment: GitLab Runner
create_home: true
shell: /bin/bash
@gam6itko
gam6itko / ch.sql
Last active October 24, 2022 23:01
Rebrain clickhouse
CREATE TABLE events_local ON CLUSTER 'local'
(
event_type String,
title String,
description String,
content String,
date Date
)
ENGINE = ReplicatedMergeTree('/ch/{cluster}/{shard}/tables/events_local', '{replica}')
PARTITION BY date