Skip to content

Instantly share code, notes, and snippets.

@enumag
enumag / readme.md
Created March 30, 2022 11:34
PHP Segmentation fault debugging
@enumag
enumag / cloud_batch_logging.php
Last active January 27, 2022 13:26
cloud_batch_logging.php
<?php declare(strict_types = 1);
use Google\Cloud\Logging\LoggingClient;
use Google\CloudFunctions\FunctionsFramework;
use GuzzleHttp\Psr7\Response;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
FunctionsFramework::http(
'entrypoint',
@enumag
enumag / cloud_logging.php
Last active January 27, 2022 13:06
[Medium] Logging in Cloud Functions
<?php declare(strict_types = 1);
use Google\Cloud\Logging\LoggingClient;
$client = new LoggingClient(['projectId' => $projectId]);
$logger = $client->psrLogger(
'app',
[
'resource' => [
'type' => 'cloud_function',
@enumag
enumag / 01 Create a debug version of the docker image.sh
Created December 10, 2020 19:41 — forked from sh41/01 Create a debug version of the docker image.sh
Debugging segmentation faults in PHP in a docker container.
git clone git@github.com:docker-library/php.git docker-library-php
## Go to the specific version you're interested in
cd docker-library-php/7.1/fpm/alpine
## Edit the .Dockerfile.
## Change
## ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data
## to
## ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --enable-debug
## Comment out or delete:
@enumag
enumag / MigrationsUpToDateTest.php
Created March 1, 2019 08:10
Doctrine schema tests
<?php declare(strict_types = 1);
namespace App\Core\Tests\Infrastructure\Doctrine;
use App\Library\Test\KernelTestCase;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;
final class MigrationsUpToDateTest extends KernelTestCase
@enumag
enumag / OrderedCollection.php
Created November 29, 2018 12:11
OrderedCollection
<?php declare(strict_types=1);
namespace App\Library\DataStructures;
use Ds\Vector;
use Iterator;
use IteratorAggregate;
final class OrderedCollection implements IteratorAggregate
{
@enumag
enumag / DeferredExplicitTrackingPolicySubscriber.php
Created October 14, 2018 20:41
DeferredExplicitTrackingPolicySubscriber
<?php declare(strict_types = 1);
namespace App\Library\Doctrine\Subscriber;
use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Events;
use Doctrine\ORM\Mapping\ClassMetadata;
final class DeferredExplicitTrackingPolicySubscriber implements EventSubscriber
@enumag
enumag / UnityPosFinder.py
Created August 22, 2018 04:54 — forked from TellowKrinkle/UnityPosFinder.py
Correlates offsets with object IDs in unity asset files
import sys
import unitypack
from unitypack.asset import Asset
if len(sys.argv) < 3:
print("Usage: " + sys.argv[0] + " assetfile.assets (offset | offsetfile.txt)\nOffset file formatting: per line \"offset [printout name]\"")
exit()
try:
targetOffsets = [[int(sys.argv[2], 0), sys.argv[2]]]
@enumag
enumag / MemoryListener.php
Created June 20, 2017 15:59
MemoryListener for PHPUnit
<?php
declare(strict_types=1);
namespace Tests\Listener;
use PHPUnit\Framework\BaseTestListener;
use PHPUnit\Framework\Test;
class MemoryListener extends BaseTestListener
mobil - hlavička moc velká
mobil - vypnout popup
mobil - na detailu košík před popis, nadpis na obrázkem
kontakt - přidat mapu
menu - hover
analytics - cíl na konverzní poměr
hledání - obrázky, css kategorie