Skip to content

Instantly share code, notes, and snippets.

Building awesome high performance microservices

Ivan Chepurnyi IvanChepurnyi

Building awesome high performance microservices
Block or report user

Report or block IvanChepurnyi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
IvanChepurnyi / server.php
Last active May 25, 2018
Simple multi-process ReactPHP server with workers control
View server.php
* Copyright © EcomDev B.V. All rights reserved.
* See LICENSE.txt for license details.
$port = $argv[1];
$serverName = $argv[2];
IvanChepurnyi /
Created Oct 28, 2016
Install Unison on Ubuntu LTE 12.04 from source
apt-get install python-software-properties
add-apt-repository ppa:avsm/ppa
apt-get update -y -f
apt-get install ocaml opam -y
mkdir -p /usr/src/unison/
cd /usr/src/unison/
IvanChepurnyi /
Created Sep 30, 2016
Optimizes autoloader for the best performance on production system
cd $magentodir
read -d '' script << PHP
\$composer = json_decode(file_get_contents('composer.json'), true);
if (!is_array(\$composer['autoload']['psr-0'][''])) {
IvanChepurnyi / php-fpm-cli
Created Sep 12, 2016
Benchmark Scripts (Root User Usage)
View php-fpm-cli
# The MIT License (MIT)
# Copyright (c) 2014 Mathias Leppich <>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
IvanChepurnyi / test.php
Created Sep 8, 2016
Sample counter server in ReactPHP
View test.php
require 'vendor/autoload.php';
$counter = new stdClass();
$counter->counter = 100000;
$counter->requests = 0;
$app = function ($request, $response) use ($counter) {
if ($request->getPath() === '/favicon.ico') {
View references-in-php.php
ini_set('memory_limit', '2G');
class ExampleByReference
public function __invoke(&$array)
foreach ($array as $index => &$value) {

Usage is quite simple, you need to create in your $HOME a directory called .acme and place there such a config.yml file in it with the following options:

# E-mail to use for the setup.
# This e-mail will receive expiration notices from Let's Encrypt.

# List of certificates to issue.
    # For each certificate, there are a few options.
View gist:dfb6107f64870453cbea
Verifying that +ivanchepurnyi is my blockchain ID.
IvanChepurnyi /
Last active Jun 15, 2017
Architectural Proposal for Magento 2 Inventory and Prices Mechanism


There are too tight relations of stock and prices to store views and websites in Magento that results in high complexity of implementation of b2b and drop shipping solutions in Magento.

The issue was very visible with the price index structure for Magento 1, and now Magento 2 stock index follows the same idea of having an index entry per website.

This strict relation to a website makes unnecessary data duplications in case if you have global stock. Although it makes over complicated multi-warehouse delivery, as you will be required to create a separate website for each warehouse, that duplicates other product data in the flat index structure and price index.


Create a separate scope entity for Price and Inventory, for using them as scope fields for respective data structures.

IvanChepurnyi / Layout.php
Last active Aug 29, 2015
<remove /> strange behaviour, with core acl="" attribute for layout file.
View Layout.php
// This code allows all calls to <remove /> being ignored
// if a block with acl attribute is valid for admin user.
// Shall I keep it in LayoutCompiler? IMO, this looks more like a bug, than a needed feature!
foreach ($ignoreNodes as $block) {
if ($block->getAttribute('ignore') !== null) {
$acl = (string)$attributes->acl;
if ($acl && Mage::getSingleton('admin/session')->isAllowed($acl)) {
You can’t perform that action at this time.