Skip to content

Instantly share code, notes, and snippets.

View egorsmkv's full-sized avatar
🌍
world, hello

Yehor Smoliakov egorsmkv

🌍
world, hello
View GitHub Profile
#include "utf8.h"
#include <stdlib.h>
size_t utf8_decode_advance(const char8_t *bytes, size_t len,
uint32_t *out_codepoint, bool *out_invalid) {
if (!bytes || len == 0)
return 0;
uint8_t b0 = bytes[0];
uint32_t codepoint = 0xFFFD;
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
/**
* SPANN High-Performance Memory-Disk Hybrid Search
// Compile with:
// clang -O3 -march=znver4 -fopenmp -ffast-math -mavx512f -mavx512dq amd_zen_matrix.c -o amd_zen_matrix
// Note: Use -march=znver5 if available in your compiler (GCC 14+ / Clang 18+).
// If not, -march=znver4 is safe and highly effective for Ryzen 9000.
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <time.h>
import math
from typing import Dict, Set, Tuple, Optional, List
from collections import defaultdict
# Type Aliases for code clarity and PEP 484 compliance
PointID = int
Coordinates = Tuple[float, ...]
class Point:
"""
use std::collections::HashMap;
use std::marker::PhantomData;
use std::sync::Arc;
use std::sync::Mutex;
/// ======== TYPES ========
type UserId = String;
/// ======== STRUCTS, ENUMS ========
@egorsmkv
egorsmkv / calc_alloc.rs
Created August 4, 2025 11:01
Rust Stack and Heap Size Demonstration
// This program demonstrates how to get a rough estimate of stack usage
// and how to track heap allocations in Rust.
//
// NOTE: This approach for stack measurement is not reliable or portable.
// It is for demonstration purposes only. The heap tracking method is a
// more robust way to monitor memory usage.
use std::alloc::{GlobalAlloc, Layout, System};
use std::sync::atomic::{AtomicUsize, Ordering};
@egorsmkv
egorsmkv / logs.txt
Created July 30, 2025 17:56
decoding frames: logs of read-video-rs run
[swscaler @ 0x120008000] No accelerated colorspace conversion found from yuv420p to rgb24.
best_video_stream_index: 0
Width: 1920, height: 1080
Duration: 494.30734451395824 seconds
FPS: 30.001577377319336
Successfully sought to frame near index 0.
Frame time: 0
Successfully sought to frame near index 30.
Frame time: 8.332895221071446
Successfully sought to frame near index 60.
@egorsmkv
egorsmkv / function-calling-LLMs.md
Last active July 30, 2025 14:57
How function calling looks like in training data for LLMs?

For Large Language Models (LLMs) to learn function calling, the training data typically includes examples that demonstrate the pattern of calling a function. This can be represented in various formats, but a common approach is to use a structured format that resembles a dialogue or a sequence of instructions where a "user" or "assistant" invokes a function with specific arguments. The representation might vary depending on the specific LLM and its intended application, but here's a general idea of how it might look:

Example Format for Training Data

  1. Text-based representation: In this format, function calls are represented as text that the model learns to predict or generate. For instance, if the task involves calling a function get_weather(city), the training data might include examples like:

    User: What is the weather like in Paris?
    Assistant: I need to call get_weather(city="Paris"). The weather in Paris is sunny.
    
@egorsmkv
egorsmkv / cv-rust.md
Created July 25, 2025 17:53
Computer Vision links mentioned in This Week in Rust materials

The sources mention several links related to computer vision, graphics, and image processing within the Rust ecosystem. These include libraries, projects, and discussions:

Graphics & Rendering Libraries/Frameworks:

  • Piston: A graphics library. Its image library has been rewritten in pure Rust, and it also features skeletal animation demos and supports "duck typing".
  • glium: A safe wrapper for OpenGL, used in the simple polar dodging game, Rusty_Dodge. Its project updates and a post-mortem have been noted.
  • gfx / gfx-rs / gfx-hal: A crate designed to display content on a screen across various platforms. Updates from its development have been highlighted. It also has a hardware abstraction layer (gfx-hal) and an ecosystem overview.
  • luminance: A type-safe, type-level, and stateless Rust graphics framework.
  • wgpu: A cross-platform graphics and compute library based on WebGPU, with multi-threading capabilities.
  • Speedy2D: A crate offering cross-platform hardware-acc
@egorsmkv
egorsmkv / speed_batch_eval_flores.py
Created July 16, 2025 17:55
Vibe-coded evaluation
import evaluate
import polars as pl
import time
import torch
from tqdm import tqdm
from transformers import AutoModelForCausalLM, AutoTokenizer
from datasets import load_dataset
# --- 1. SETUP ---
model_id = '/home/smlkw/en-uk-t/final-checkpoints/kulyk-en-uk'