Skip to content

Instantly share code, notes, and snippets.

View pastuhov's full-sized avatar
💭
I may be slow to respond.

Pastuhov Kirill pastuhov

💭
I may be slow to respond.
View GitHub Profile
@pastuhov
pastuhov / docker-compose.yml
Last active October 15, 2025 13:30
Simple mock web server with a delayed response
services:
nginx:
image: openresty/openresty:alpine
ports:
- "8080:80"
volumes:
- ./nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf:ro
package queue
// Queue is a FIFO collection.
//
// Concurrency: not safe for concurrent use.
type Queue[T any] struct {
elements []T
head int
}
package stack
// Stack is a LIFO collection.
//
// Concurrency: not safe for concurrent use.
type Stack[T any] struct {
elements []T
}
func (s *Stack[T]) Push(element T) {
{
"id": "base",
"properties": {
"prop1": {
"type": "number"
},
"prop2": {
"type": "number"
},
"prop_obj": {
@pastuhov
pastuhov / Dockerfile
Created June 24, 2022 06:07
Dockerized python app with latest librdkafka lib
FROM gcc:bullseye AS builder
WORKDIR /root
RUN git clone https://github.com/edenhill/librdkafka.git
WORKDIR /root/librdkafka
RUN /root/librdkafka/configure --prefix=/root/librdkafka
RUN make
RUN make install
FROM python:3.10.5-bullseye
@pastuhov
pastuhov / docker-compose.yml
Created February 2, 2022 05:45
kafka + schema-registry + akhq
version: '3.6'
volumes:
zookeeper-data-0:
driver: local
zookeeper-log-0:
driver: local
kafka-data-0:
driver: local
services:
akhq:
@pastuhov
pastuhov / python_m1.sh
Created September 28, 2021 13:58
Python on apple silicon m1
#!/usr/bin/env zsh
mdir=${0:a:h}
/usr/bin/arch -x86_64 $mdir/python "$@"
@pastuhov
pastuhov / query.sql
Created June 8, 2021 05:58
Sentry db query - issues
SET TIME ZONE 5;
SELECT
error_count,
date_added,
error_count - lag(error_count, 1)
OVER () delta,
avg(error_count)
OVER () average_count,
CASE WHEN error_count > avg(error_count) OVER ()
@pastuhov
pastuhov / query.sql
Created June 8, 2021 05:53
jira db query - completed tasks & story points
SELECT count(t.ID) AS "completed tasks",
CAST(sum(c.NUMBERVALUE) AS unsigned integer) AS "story points",
coalesce(user.display_name, ASSIGNEE) AS display_name,
ASSIGNEE AS jiraname
FROM jira.jiraissue t
JOIN customfieldvalue AS c ON c.ISSUE = t.ID
AND c.CUSTOMFIELD = 10008
JOIN customfieldvalue AS s ON s.ISSUE = t.ID
AND s.CUSTOMFIELD = 10000
JOIN ao_60db71_sprint AS sprint ON sprint.ID = s.STRINGVALUE
@pastuhov
pastuhov / bash
Last active July 16, 2020 08:29
OCR last screenshot and copy on mac
ss=$(ls -t ~/Desktop/*.* | head -n1) && tesseract $ss stdout |tr -d \\f|pbcopy