Skip to content

Instantly share code, notes, and snippets.

Avatar

Grégoire Pineau lyrixx

View GitHub Profile
@lyrixx
lyrixx / README.md
Last active August 18, 2022 08:41
How to "control" auto-completion in Google Chrome address bar?
View README.md

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

https://github.com/foobar/hello/projects/9

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

@lyrixx
lyrixx / ContainerTest.php
Last active December 16, 2022 08:20
Test applications services can boot
View ContainerTest.php
<?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
lyrixx / test.php
Created August 1, 2022 08:59
Symfony Playgound with its Container and a custom configuration
View test.php
<?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
lyrixx / watch.sh
Created July 22, 2022 13:54
Watch dir and copy on change
View watch.sh
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
lyrixx / README.md
Last active March 22, 2022 14:01
PHP + Stream Wrapper + Stream Filter // Reproducer
View README.md

PHP + Stream Wrapper + Stream Filter // Reproducer

Reproducer for php/php-src#8219

Usage

Run php index.php

Output

@lyrixx
lyrixx / index.php
Created April 22, 2020 13:20
Very low memory usage iterator
View index.php
<?php
function m()
{
$memory = round(memory_get_usage() / 1024 / 1024, 2);
$frame = debug_backtrace(0, 1)[0];
$file = basename($frame['file']);
$line = $frame['line'];
printf("%s:%d | %sMb\n", $file, $line, $memory);
@lyrixx
lyrixx / README.md
Last active February 21, 2020 13:51
Add shared tracks in to slack to a Spotify Playlist
View README.md
@lyrixx
lyrixx / README.md
Last active March 17, 2020 16:34
Spotify does not handle Media Keys
View README.md

Debug media keys and Spotify

TL;DR: There is a bug in gnome that have been fixed in 3.3. But you can temporary fix this issue with: pkill gsd-media-keys

Let's Debug

  1. We check logs

@lyrixx
lyrixx / .gitignore
Last active February 4, 2023 14:50
UUID generation in PHP
@lyrixx
lyrixx / HardCoreDebugLogger.php
Last active January 31, 2023 07:26
Hardcore Debug Logger
View HardCoreDebugLogger.php
<?php
const STREAM_OPEN_FOR_INCLUDE = 128;
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);