Skip to content

Instantly share code, notes, and snippets.

View B-Galati's full-sized avatar
😁

Benoit GALATI B-Galati

😁
View GitHub Profile
@shulard
shulard / DynamicKernelResolution.php
Last active January 30, 2020 08:00
Define dynamic kernel for a specific test case !
<?php declare(strict_types=1);
namespace App\Tests\Features\SynchronousJob;
use App\Tests\Features\SynchronousTestCase;
use App\Tests\Features\SynchronousTestKernel;
class PushJobWithRetryOnTaskFailTest extends SynchronousTestCase
{
protected static function createKernel(array $options = [])
@lyrixx
lyrixx / HardCoreDebugLogger.php
Last active April 27, 2024 14:09
Hardcore Debug Logger
<?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);
@gaearon
gaearon / modern_js.md
Last active April 18, 2024 15:01
Modern JavaScript in React Documentation

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
@rkrzr
rkrzr / auto_tags.py
Last active April 10, 2024 11:14
Automatically generate ansible tags of the same name for each role in a playbook
"""
This module implements an Ansible plugin that is triggered at the start of a playbook.
The plugin dynamically generates a tag for each role. Each tag has the same name as its role.
The advantage of this is that it saves you some boilerplate, because you don't have to wrap
all tasks of a role in an additional block and assign a tag to that.
Additionally, it works automatically when you add new roles to your playbook.
Usage is exactly the same as without this plugin:
@weaverryan
weaverryan / FooController.php
Last active April 18, 2017 13:58
Autowiring controller args
<?php
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Psr\Log\LoggerInterface;
/**
* This class is now a service, so you can use normal __construct DI if you want!
*/
@asvinours
asvinours / gzip_static.sh
Last active April 14, 2017 15:24
Test for static gzip and brotli pre-compressed files
#!/usr/bin/env bash
LIST_URLS=("/foo.bar");
HOSTS=("example.com");
PROTOCOLS=("http" "https");
for PROTOCOL in ${PROTOCOLS[@]:0};
do
for HOST in ${HOSTS[@]:0};
do
@radium226
radium226 / notify-hq.sh
Created April 5, 2017 16:32
5 services que m'a rendu systemd
#!/bin/bash
export RED_COLOR="\033[0;31m"
export DEFAULT_COLOR="\033[0m"
declare message=" ${RED_COLOR}/!\ ${DEFAULT_COLOR}${1}${RED_COLOR} /!\ ${DEFAULT_COLOR}"
declare index=
ls -1 "/dev/pts" | grep -E '[0-9]+' | while read index; do
echo -e "${message}" >>"/dev/pts/${index}"
done
@denji
denji / README.md
Last active April 24, 2024 17:20 — forked from Cubixmeister/README.md
Simple Sentry docker-compose.yml
  1. Download docker-compose.yml to dir named sentry
  2. Change SENTRY_SECRET_KEY to random 32 char string
  3. Run docker-compose up -d
  4. Run docker-compose exec sentry sentry upgrade to setup database and create admin user
  5. (Optional) Run docker-compose exec sentry pip install sentry-slack if you want slack plugin, it can be done later
  6. Run docker-compose restart sentry
  7. Sentry is now running on public port 9000
@guilhermeblanco
guilhermeblanco / debug-fpm-segfaut.md
Created June 8, 2016 15:59
Debugging PHP-FPM segfaults

Assuming PHP is compiled with debug enabled.

$ gdb /usr/sbin/php-fpm

Then:

r --nodaemonize --fpm-config /etc/php7/fpm/php-fpm.conf
@skowron-line
skowron-line / monolog.json
Last active December 30, 2023 18:58
lnav Monolog format
{
"monolog": {
"title": "Monolog log file",
"description": "Monolog log format",
"url": "https://github.com/Seldaek/monolog",
"regex": {
"default": {
"pattern": "\\[(?P<timestamp>.*)\\] (?P<logger>\\w+).(?P<level>\\w+): (?P<message>[^\\[\\{]+) (?P<context>[\\[\\{].*[\\]\\}]) (?P<extra>[\\[\\{].*[\\]\\}])"
}
},