Skip to content

Instantly share code, notes, and snippets.

View gam6itko's full-sized avatar
💭

Alexander Strizhak gam6itko

💭
  • Russia, Ryazan
View GitHub Profile
@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
@roxblnfk
roxblnfk / !index.md
Last active October 21, 2022 23:18
CYCLE ORM v2 SUMMARY [Ru]

Cycle ORM V2 (dev)

Gist посвящён общим изменениям в Cycle ORM 2.0 относительно первой версии.
Разработка ведётся в ветке 2.0.x-dev, по мере поступления обновлений гист будет дополняться.

Установка:

В composer.json установить директиву minimum-stability: "dev",
затем выполнить composer require cycle/orm "2.0.x-dev".
Рекомендуется также установить "prefer-stable": true.

@jpswade
jpswade / php7.4-fpm-alpine
Last active October 19, 2024 10:44
PHP 7.4 PHP-FPM Alpine with core extensions gd
FROM php:7.4-fpm-alpine
# @see https://hub.docker.com/r/jpswade/php7.4-fpm-alpine
MAINTAINER Agent Software <[email protected]>
# Install gd, iconv, mbstring, mysql, soap, sockets, zip, and zlib extensions
# see example at https://hub.docker.com/_/php/
RUN apk add --update \
$PHPIZE_DEPS \
freetype-dev \
git \
@mojaray2k
mojaray2k / unique-array-values-js.md
Created May 28, 2020 15:48
3 Ways to get unique values from an array in Javascript

Here are 3 ways to retrieve unique values from arrays in Javascript

  1. The array.filter method which is a higher order function which means it takes a function as it's argument.
const someArray = ['😁', '💀', '💀', '💩', '💙', '😁', '💙'];

const getUniqueValues = (array) => (
  array.filter((currentValue, index, arr) => (
		arr.indexOf(currentValue) === index
@pmkay
pmkay / installing-postman.md
Created April 27, 2020 02:49 — forked from ba11b0y/installing-postman.md
Installing Postman on Ubuntu/Gnome

Since Chrome apps are now being deprecated. Download postman from https://dl.pstmn.io/download/latest/linux

Although I highly recommend using a snap

sudo snap install postman

Installing Postman

tar -xzf Postman-linux-x64-5.3.2.tar.gz
@fracasula
fracasula / encrypt_decrypt.go
Last active July 17, 2025 09:12
A simple example with Golang that uses AES-128 to encrypt and decrypt messages.
package mycrypto
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"io"
"time"
)
@gskema
gskema / noinspection.php
Last active July 12, 2025 21:13
PhpStorm @noinspection list of all tags
<?php
/** @noinspection ? */
// PhpUndefinedGotoLabelInspection Undefined goto label
// PhpUndefinedVariableInspection Undefined variable
// PhpUndefinedMethodInspection Undefined method
// PhpUndefinedNamespaceInspection Undefined namespace
// PhpUndefinedClassInspection Undefined class
// PhpUndefinedFunctionInspection Undefined function
@michaelboke
michaelboke / Dockerfile
Last active August 12, 2025 08:32
Docker scratch x509 fix
FROM golang:alpine as builder
WORKDIR /app
#the following 2 steps are optional if your image does not already have the certificate
# package installed, golang:alpine now seems to have it. But a more base image could be missing it.
#RUN apk update && apk upgrade && apk add --no-cache ca-certificates
#RUN update-ca-certificates
ADD main.go /app/main.go
RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags="-s -w" -installsuffix cgo -o app .
FROM scratch
@andrewdalpino
andrewdalpino / PHP SplStack vs SplQueue vs Array
Last active August 13, 2023 10:39
This is a performance benchmark comparing PHP SplStack, SplQueue, and plain array performance for insert and read/remove operations.
<?php
namespace PhpBenchmarks;
use SplStack;
use SplQueue;
const NUM_TEST_ITEMS = 100000;
const DATA_SIZE = 32; //Bytes.
@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