Skip to content

Instantly share code, notes, and snippets.

<?php
declare(strict_types=1);
namespace App\JsonRpc\ArgumentResolver;
use App\JsonRpc\Exception\ValidationException;
use App\JsonRpc\RpcMethodRequest;
use Premier\ArgumentResolver\ArgumentMetadata;
use Premier\ArgumentResolver\ArgumentValueResolverInterface;
<?php
declare(strict_types=1);
namespace App\JsonRpc\ArgumentResolver;
use App\Doctrine\Registry;
use App\JsonRpc\Attributes\Entity;
use LogicException;
use Premier\ArgumentResolver\ArgumentMetadata;
COPY (SELECT *
FROM car_recommendation_part
WHERE recommendation_id IN (
SELECT id
from car_recommendation
WHERE car_id NOT IN (
SELECT car.id
FROM orders
JOIN car ON car.uuid = orders.car_id
WHERE car_id IS NOT NULL
#!/bin/bash
RULE_FILE=/etc/udev/rules.d/00-keystation-88.rules
SERVICE_FILE=/etc/systemd/system/keystation88.service
SCRIPT_FILE=$(realpath "$0")
install() {
cat >$RULE_FILE <<EOL
KERNEL=="dmmidi2", SUBSYSTEM=="sound", RUN+="$SCRIPT_FILE event"
EOL
<?php
require_once __DIR__.'/vendor/autoload.php';
Symfony\Component\ErrorHandler\Debug::enable();
$arr = Symfony\Component\Yaml\Yaml::parse(\file_get_contents(__DIR__.'/config/packages/rpc_server.yaml'));
$dirs = \array_merge(...\array_values($arr['rpc_server']['mapping']));
$dirs = \array_map(fn (string $path) => \str_replace('%kernel.project_dir%', __DIR__, $path), $dirs);
$dirs = \array_filter($dirs, fn (string $path) => \file_exists($path));
@grachevko
grachevko / readme.md
Last active April 26, 2020 18:28
Replace Doctrine targetEntity string to costant class

find:

  • (targetEntity=)".+\\([^"]+)"
  • (class=)".+\\([^"]+)"

replace: $1$2::class

composer require `composer info --name-only --direct | grep -e '^symfony/' | awk '{$1=$1;print $0":^4.4"}' | tr '\n' ' '`
@grachevko
grachevko / git-find-big-commit.sh
Created October 17, 2019 10:02 — forked from BBBSnowball/git-find-big-commit.sh
Find big commits in git
#!/bin/sh
# http://stackoverflow.com/a/1557398
for sha in $(git rev-list --all --pretty=format:"" | sed "s/^commit //") ; do git diff-tree -r -c -M -C --no-commit-id $sha | awk '{print $4}' | git cat-file --batch-check 2>/dev/null | awk '{ sum+=$3 } END {printf "%010d %s\n", sum, "'"$sha"'"}' ; done | sort | tail
Often, the Docker daemon is started with too low a limit for lockable memory. That's the limit you are seeing in your logs:
Increase RLIMIT_MEMLOCK, soft limit: 65536, hard limit: 65536
The containers inherit this limit, which then becomes a problem for Elasticsearch when it tries lock more memory than allowed.
If you look at your Docker daemon's limits, you will probably see this:
# grep locked /proc/$(ps --no-headers -o pid -C dockerd | tr -d ' ')/limits
Max locked memory 65536 65536 bytes
When we would much prefer to see:
<?php
declare(strict_types=1);
namespace App\Product\Quality;
use App\Entity\Product\Segment;
use Generator;
use InvalidArgumentException;
use Money\Money;