Skip to content

Instantly share code, notes, and snippets.

View yariksheptykin's full-sized avatar

Iaroslav Sheptykin yariksheptykin

View GitHub Profile
#!/usr/bin/env php
<?php
// Define how to run composer:
// $composer = 'docker run --rm --user=1234 -v /home/user/.ssh/known_hosts:/home/www-data/.ssh/known_hosts:ro -v /run/user/1234/keyring/ssh:/ssh-auth.sock:ro -e SSH_AUTH_SOCK=/ssh-auth.sock -v /home/user/.composer:/composer:rw -e COMPOSER_HOME=/composer -v /home/user/.composer/cache:/composer/cache:rw -e COMPOSER_CACHE_DIR=/composer/cache pimcore/pimcore composer';
$composer = 'composer';
function shell_exec_dry(bool $dryRun, string $command): ?string
{
if ($dryRun) {
@yariksheptykin
yariksheptykin / git-embed.php
Created July 8, 2025 21:09
Embed remote repo as sub-dir
#!/usr/bin/env php
<?php
/**
* This is a git plugin that helps to embed another git repository as a subdirectory of the
* current repository.
*/
// Check whether git filter-repo is installed and available
if (empty(trim(shell_exec('which git-filter-repo')))) {
echo "git embed: git-filter-repo is not installed or not available in PATH.\n";
echo "Please install git-filter-repo to use this command.\n";
@yariksheptykin
yariksheptykin / skeleton.php-cs-fixer.php
Created March 27, 2024 15:44
skeleton-rules.php-cs-fixer.php
<?php
return [
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHP82Migration' => true,
'@DoctrineAnnotation' => true,
'@PHPUnit84Migration:risky' => true,
'blank_line_after_opening_tag' => false,
'declare_strict_types' => true,
'single_line_throw' => false,

How to Practice Git Rebase

This guide will walk you through practicing git rebase on a local repository. We'll start by creating a simple repository and make some commits, then practice rebasing a branch onto the updated main branch.

1. Initialize an empty repository:

Open your terminal and navigate to the directory where you want to create the repository. Then, run:

git init
@yariksheptykin
yariksheptykin / pimcore-check-build.php
Last active March 14, 2023 16:21
A simple php script to check if pimcore is build for production
#!/usr/bin/env php
<?php
/**
* This file checks if pimcore is correctly built for production mode.
* Execute it with `php -d zend.assertions=1 check-build.php`.
* Or from the web: `wget -qO- https://gist.githubusercontent.com/yariksheptykin/4eb979490fa51df77309e02f32173d69/raw/pimcore-check-build.php | php -d zend.assertions=1 --`.
*/
declare(strict_types=1);
// Enable assertions.
services:
db:
image: ubuntu:22.04
volumes:
- "${SSH_AUTH_SOCK:?SSH configuration is incomplete}:/ssh-agent"
environment:
SSH_AUTH_SOCK: '/ssh-agent'
PROXY_SSH_SERVER: '${PROXY_SSH_SERVER:?SSH configuration is incomplete}'
PROXY_SSH_USER: '${PROXY_SSH_USER:?SSH configuration is incomplete}'
REMOTE_MYSQL_HOST: ${REMOTE_MYSQL_HOST:?Database configuration seems to be missing}
; Official docs from pimcore: https://pimcore.com/docs/pimcore/current/Development_Documentation/Installation_and_Upgrade/System_Setup_and_Hosting/Performance_Guide.html#page_Performance-Best-Practice-Guide
; PHP 8 OPcache and JIT compiler
opcache.enable=${OPCACHE_ENABLE}
opcache.enable_cli=${OPCACHE_ENABLE}
opcache.jit_buffer_size=256M
; Use the OPcache class preloading
opcache.preload_user=www-data
opcache.preload=${OPCACHE_PRELOAD_PATH}
@yariksheptykin
yariksheptykin / pimcore-demo.sh
Last active December 9, 2021 14:40
Spin up pimcore demo
#!/usr/bin/env bash
set -eu
# A bash script to spin up pimcore demo locally using docker.
# The script follows the README instructions for docker.
# See: https://github.com/pimcore/demo
# Usage:
# curl -s https://gist.githubusercontent.com/yariksheptykin/9eaa93910c5ef9360697a507cd01488a/raw/pimcore-demo.sh | bash -s [up|down] <project-name>
@yariksheptykin
yariksheptykin / git-rev-name.sh
Created July 7, 2021 11:23
git revision name in english
#!/usr/bin/env bash
COMMIT_ID=$(git rev-parse --short ${1:-HEAD})
NOUNS=$(curl --silent https://raw.githubusercontent.com/hugsy/stuff/22dadc624c32cdc8f33c6e7f45022a45fb073bfd/random-word/english-nouns.txt)
NOUN=$(echo "$NOUNS" | sed -n "$((16#$COMMIT_ID % $(echo "$NOUNS" | wc -l) ))p")
ADJECTIVES=$(curl --silent https://gist.githubusercontent.com/hugsy/8910dc78d208e40de42deb29e62df913/raw/eec99c5597a73f6a9240cab26965a8609fa0f6ea/english-adjectives.txt)
ADJECTIVE=$(echo "$ADJECTIVES" | sed -n "$((16#$COMMIT_ID % $(echo "$ADJECTIVES" | wc -l) ))p")