Skip to content

Instantly share code, notes, and snippets.

View morozov's full-sized avatar

Sergei Morozov morozov

View GitHub Profile
from abc import ABC, abstractmethod
class Operation(ABC):
@abstractmethod
def apply(self, color):
pass
@abstractmethod
def __str__(self):
@morozov
morozov / bitbucket-iterate.sh
Created September 24, 2023 18:44
Iterator of paginated Bitbucket REST API results
#!/bin/bash
API_URL="$1"
while true; do
echo "Fetching $API_URL" >&2
RESPONSE="$(curl -sn "$API_URL")"
if [[ $? -ne 0 ]]; then
@morozov
morozov / Driver.php
Created November 6, 2021 01:04
External PDO driver middleware for Doctrine DBAL
<?php
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\API\ExceptionConverter;
use Doctrine\DBAL\Driver\PDO\Connection as PDOConnection;
use Doctrine\DBAL\Platforms\AbstractPlatform;
class Driver implements DriverInterface
{
@morozov
morozov / README.md
Last active September 27, 2022 19:18
DBZ-2975: Support for Multiple Databases per SQL Server Connector
@morozov
morozov / README.md
Created January 23, 2021 01:37
Support for Multiple Databases per SQL Server Connector

Support for Multiple Databases per SQL Server Connector

Background

Unlike the Debezium connector for MySQL which consumes the changes from all databases via a single binlog, the SQL Server connector interacts with the CDC schema which is deployed individually for each database.

At SugarCRM, we have a number of SQL Server instances hosting more than a hundred databases each, the changes from which we'd like to capture using the Debezium connector for SQL Server. Having to deploy a hundred connectors per instance may be suboptimal both from the resourcing and the operations standpoints.

Research

@morozov
morozov / benchmark.php
Last active November 12, 2020 02:47
SQL Parser Benchmark
<?php
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\ExpandArrayParameters;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\SQL\Parser;
use Doctrine\DBAL\SQLParserUtils;
require __DIR__ . '/vendor/autoload.php';
@morozov
morozov / diff-class-map.sh
Created August 12, 2020 16:44
Generates the diff between Composer autload files from a pull request
#!/usr/bin/env bash
set -eu
if [ $# -ne 1 ]; then
echo "Usage: `basename $0` <pull>";
exit 1;
fi
PULL="$1"
@morozov
morozov / .gitignore
Last active June 20, 2020 05:03
PHPUnit and Psalm
/vendor
@morozov
morozov / .gitignore
Last active May 26, 2020 03:14
composer/package-versions-deprecated incompatible with humbug/box
/example.phar
/vendor
sudo ./sockdump.py --format string --output dump.txt ~/.phpbrew/php/php-7.4.5/var/run/php-fpm.sock