Skip to content

Instantly share code, notes, and snippets.

View resetius's full-sized avatar

Alexey Ozeritskiy resetius

View GitHub Profile
алг
нач
| Решение Ax=b методом Гаусса с частичным выбором, нормировкой строки
| и обратным ходом с делением на диагональ. Матрица Гильберта, b=1.
| Вектор решения записывается в B. В конце выводятся нормы невязки.
| параметры
цел n
вещ Eps
n := 16
@resetius
resetius / parser.cpp
Created September 15, 2025 08:11
parser
using TAstTask = TExpectedTask<TExprPtr, TParserError, TLoc>;
// factor ::= Number | Ident | '(' Expr ')' | 'fun' ...
TAstTask factor(TTokenStream& s) {
auto tok = co_await s.Next();
if (tok.Type == TToken::Number)
co_return std::make_shared<TNumberExpr>(tok.Loc, tok.Value.i64);
if (tok.Type == TToken::Identifier)
co_return std::make_shared<TIdentExpr>(tok.Loc, tok.Name);
if (tok.Type == TToken::Keyword && tok.Value == (int)TToken::Fun)
@resetius
resetius / main.cpp
Last active August 4, 2025 22:45
ydb::actors example
#include <ydb/library/actors/core/actorsystem.h>
#include <ydb/library/actors/core/executor_pool_basic.h>
#include <ydb/library/actors/core/scheduler_basic.h>
#include <ydb/library/actors/core/log.h>
#include <ydb/library/actors/core/actor_bootstrapped.h>
#include <ydb/library/actors/util/should_continue.h>
#include <util/system/sigset.h>
#include <util/generic/xrange.h>
// rpi5 (4 cores, 16GB), actors=100, messages=1000000, batch size=1024
@resetius
resetius / poly.cpp
Created June 25, 2024 19:46
polynomial expansion in Polish notation
#include <algorithm>
#include <fstream>
#include <vector>
#include <string>
#include <iostream>
#include <unordered_map>
#include <assert.h>
using namespace std;
@resetius
resetius / process-vga-pallette.php
Created October 3, 2023 22:35 — forked from cesarmiquel/process-vga-pallette.php
VGA 256 Color Palette to RGB
<?php
$im = imagecreatefrompng("vga-palette.png");
$sx = (int) 800 / 16;
$sy = (int) 800 / 16;
$ox = (int) ($sx / 2);
$oy = (int) ($sx / 2);
for($y = 0; $y < 16; $y++) {
for($x = 0; $x < 16; $x++) {
$rgb = imagecolorat($im, $sx*$x + $ox, $sy*$y + $oy);
#include <stdio.h>
int perevod(char *s)
{
int code[256];
int i = 0;
int N = 0;
for (i = 0;i < 256; i ++) {
code[i] = 0;
}
#include <vector>
#include <tbb/enumerable_thread_specific.h>
class A;
class B {
public:
//std::vector<std::vector<A> > b; // <- can be compiled both g++ and cl
tbb::enumerable_thread_specific<std::vector<A> > b; // <- fails on cl
~B();