Navigation Menu

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 / MasterTrait.php
Last active August 14, 2023 09:16
Use Master yii2 activerecord trait
<?php
namespace common\models;
trait MasterTrait
{
public static function getDb()
{
$connection = clone \Yii::$app->getDb();
$connection->enableSlaves = false;
return $connection;
{
"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 / AcceptanceHelper.php
Last active December 27, 2021 21:42
codeception page load wait helper
<?php
namespace tests\codeception\common\_support;
use Codeception\Exception\ModuleException;
/**
*
*/
class AcceptanceHelper extends \Codeception\Module
@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
@pastuhov
pastuhov / index.js
Created February 15, 2020 05:42
modify xhr response
const chromeLauncher = require('chrome-launcher');
const CDP = require('chrome-remote-interface');
const atob = require('atob');
const btoa = require('btoa');
async function main() {
const chrome = await chromeLauncher.launch({
chromeFlags: [
'--window-size=1200,800',
'--user-data-dir=/tmp/chrome-testing',