Skip to content

Instantly share code, notes, and snippets.

View morozov's full-sized avatar

Sergei Morozov morozov

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / README.md
Last active January 17, 2024 00:47
A prepare-commit-msg hook which automatically composes commit message based on Jira task summary

Automatic commit message generator based on Jira task summary

Installation

  1. Make the script executable: chmod +x jira-prepare-commit-msg.py
  2. Copy or symlink it to the repository hooks directory: cp jira-prepare-commit-msg.py /path/to/repo/.git/hooks/prepare-commit-msg or to the global hooks directory: cp jira-prepare-commit-msg.py ~/.config/git/hooks/prepare-commit-msg.
  3. Specify the URL of your Jira server, your username and API token. Make sure HTTPS is used when possible, since the username and the token are sent unencrypted by means of Basic HTTP authentication.
from abc import ABC, abstractmethod
class Operation(ABC):
@abstractmethod
def apply(self, color):
pass
@abstractmethod
def __str__(self):