Skip to content

Instantly share code, notes, and snippets.

View matej21's full-sized avatar

David Matějka matej21

View GitHub Profile
name where-are-we
description Give the current standing of the whole task or milestone — a short summary of what is being built, an honest assessment of what actually works, and what happens next and who does it. Counters both the reflex to declare success and the habit of stopping without saying what is still missing.

Report where the work stands: what it is, what is real, what comes next. Counter the reflex to declare success, and never end without saying what is still missing.

Scope is the whole task or milestone under way — not only the last edit. If the session covers several separate tasks, say which one this is about.

First

#!/usr/bin/env bash
# cpu-lease — cooperative CPU reservation broker for concurrent agents.
#
# Model: leases come out of a fixed pool of whole SMT pairs. Every lease is a
# transient scope under leases.slice; the slices that hold unleased work are
# narrowed to the complement of what's leased. They are cgroup siblings of
# leases.slice on purpose — cpuset is hierarchical, so a lease nested inside a
# narrowed slice could never exceed it.
#
# Requires cpuset delegated to the user manager; see `cpu-lease install`.
#!/usr/bin/env bash
# cpu-lease — cooperative CPU reservation broker for concurrent agents.
#
# Model: leases come out of a fixed pool of whole SMT pairs. Every lease is a
# transient scope under leases.slice; the slices that hold unleased work are
# narrowed to the complement of what's leased. They are cgroup siblings of
# leases.slice on purpose — cpuset is hierarchical, so a lease nested inside a
# narrowed slice could never exceed it.
#
# Requires cpuset delegated to the user manager; see `cpu-lease install`.
@matej21
matej21 / cf-do.sh
Last active April 24, 2026 12:58
Durable object query REST API
curl -X POST \
"https://api.cloudflare.com/client/v4/accounts/{account_id}/workers/durable-objects/namespaces/{namespace_id}/query" \
-H "Authorization: Bearer <token>" \
-H "content-type: application/json" \
--data-raw '{
"queries": [{"sql": "select * from event_log"}],
"durable_object_id": "<do_id>"
}'
<?php
protected function resetPersistentParameters($args)
{
$rc = new Nette\Application\UI\PresenterComponentReflection($this);
$propertyValues = $rc->getDefaultProperties();
foreach ($rc->getPersistentParams() as $param => $def) {
if (!array_key_exists($param, $args) && array_key_exists($param, $propertyValues)) {
$args[$param] = $propertyValues[$param];
}
}
<?php declare(strict_types = 1);
namespace AppTests\PhpStan\NextrasOrm;
use Nextras\Orm\Entity\Entity;
use PhpParser\Node;
use PhpParser\Node\Expr\MethodCall;
use PHPStan\Analyser\Scope;
use PHPStan\Broker\Broker;
use PHPStan\Rules\Rule;
<?php declare(strict_types = 1);
namespace App\Core\Latte;
use App\ImplementationException;
use Latte\Compiler;
use Latte\MacroNode;
use Latte\Macros\MacroSet;
use Latte\PhpWriter;
<?php declare(strict_types = 1);
namespace App\Core\Orm;
use MabeEnum\Enum;
use Nextras\Orm\Entity\IEntity;
use Nextras\Orm\Entity\IPropertyContainer;
use Nextras\Orm\Entity\Reflection\PropertyMetadata;
@matej21
matej21 / a.php
Last active February 1, 2017 13:46
<?php
$a = 1;
var_dump($a); //prints 2
.highlight, .blob-code {
tab-size: 4 !important;
}
.repo-list .repo-list-item {
padding-top: 3px;
padding-bottom: 5px;
}
.repo-list .repo-list-meta {