Skip to content

Instantly share code, notes, and snippets.

View vadim2404's full-sized avatar
🏠
Working from home

Vadim Kharitonov vadim2404

🏠
Working from home
View GitHub Profile
@vadim2404
vadim2404 / day3_part1.py
Last active December 3, 2023 11:00
Day 3
#!/usr/bin/env python3
from typing import List, Tuple
LEFT_RIGHT_DIRECTIONS = tuple(range(-1, 2))
CENTRAL_DIRECTIONS = tuple(i for i in range(-1, 2) if i != 0)
with open("input.txt", "r") as f:
matrix = [line.strip() for line in f]
#!/usr/bin/env php
<?php
$jobs = new \SplQueue();
$workers = (int) `nproc`;
for ($i = 0; $i < 5 * $workers; ++$i) {
$jobs->enqueue(rand(100, 500));
}
module.exports = (function () {
var prev = function (x) {
return x & (x - 1);
}, next = function (x) {
return (x | (x - 1)) + 1;
}, Summator = function (length) {
if (1 > length) {
throw {
message: 'Length is too small',
};
<?php
namespace Acme\DemoBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
class DoctrineEntityListenerPass implements CompilerPassInterface
{