Skip to content

Instantly share code, notes, and snippets.


Grégoire Pineau lyrixx

View GitHub Profile
lyrixx / .gitignore
Last active February 4, 2023 14:50
UUID generation in PHP
lyrixx / HardCoreDebugLogger.php
Last active January 31, 2023 07:26
Hardcore Debug Logger
View HardCoreDebugLogger.php
final class HardCoreDebugLogger
public static function register(string $output = 'php://stdout')
register_tick_function(function () use ($output) {
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
lyrixx / post-checkout
Created June 26, 2013 13:37
Git post checkout
View post-checkout
# Put this file at: .git/hooks/post-checkout
# and make it executable
# You can install it system wide too, see
lyrixx / ContainerTest.php
Last active December 16, 2022 08:20
Test applications services can boot
View ContainerTest.php
namespace Tests\Integration;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Config\Util\XmlUtils;
class ContainerTest extends KernelTestCase
private const FILTER_LIST = [
lyrixx / segfault-finder.php
Last active August 25, 2022 13:51
How to find a segfault in PHP
View segfault-finder.php
register_tick_function(function() {
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
$last = reset($bt);
$info = sprintf("%s +%d\n", $last['file'], $last['line']);
file_put_contents('/tmp/segfault.txt', $info, FILE_APPEND);
// or
// file_put_contents('php://output', $info, FILE_APPEND);
lyrixx /
Created July 22, 2022 13:54
Watch dir and copy on change
watch -n 1 cp -u -R ./source ./dest
# Run every seconds: `-n 1`
# Copy everything from "source" to "dest":
# `-R ./source ./dest`
# But only if the content is different `-u`
lyrixx /
Last active August 18, 2022 08:41
How to "control" auto-completion in Google Chrome address bar?

How to "control" auto-completion in Google Chrome address bar?

For a while, when I type g in the address bar, it suggests me the following URL

But I don't want this URL at the first position. I don't even use this URL!

lyrixx / test.php
Created August 1, 2022 08:59
Symfony Playgound with its Container and a custom configuration
View test.php
require __DIR__ . '/vendor/autoload.php';
use Symfony\Component\Console\Output\StreamOutput;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
$k = new class('prod', false) extends AppKernel implements CompilerPassInterface {
public function process(ContainerBuilder $container)
lyrixx /
Last active March 22, 2022 14:01
PHP + Stream Wrapper + Stream Filter // Reproducer

PHP + Stream Wrapper + Stream Filter // Reproducer

Reproducer for php/php-src#8219


Run php index.php


lyrixx / run.php
Last active October 7, 2021 12:08
Updated your templates with the new twig include
View run.php
- "symfony/finder: ~3.0"
- "symfony/console: ~3.0"
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;