Skip to content

Instantly share code, notes, and snippets.

View socketpair's full-sized avatar

Коренберг Марк socketpair

View GitHub Profile
@socketpair
socketpair / Await_uring.cpp
Last active July 5, 2025 11:29
Сегфолт от нейросети
// echo_server.cpp – minimalist echo‑server using C++23 coroutines + io_uring // g++ -std=c++23 -Wall -O2 echo_server.cpp -luring -o echo_server
#include <coroutine> #include <liburing.h> #include <sys/socket.h> #include <netinet/in.h> #include <unistd.h> #include <cstring> #include <cerrno> #include <system_error> #include <vector> #include <iostream> #include <memory>
//--------------------------------------------------------------------- // Small RAII helpers ------------------------------------------------- //--------------------------------------------------------------------- class UniqueFd { int fd_ = -1; public: UniqueFd() = default; explicit UniqueFd(int fd) : fd_(fd) {} UniqueFd(const UniqueFd&) = delete; UniqueFd& operator=(const UniqueFd&) = delete; UniqueFd(UniqueFd&& other) noexcept : fd_(other.fd_) { other.fd_ = -1; } UniqueFd& operator=(UniqueFd&& other) noexcept { if (this != &other) { reset(); fd_ = other.fd_; other.fd_ = -1; } return *this; } ~UniqueFd() { reset(); } int get() const { ret
@socketpair
socketpair / xfs_snap.py
Created November 6, 2023 19:14
XFS snapshot
import argparse
import json
import logging
import os
from contextlib import contextmanager
from errno import EINVAL
from fcntl import LOCK_EX, flock, ioctl
from os import O_CLOEXEC, O_DIRECTORY, O_RDONLY, close, open as os_open
from pathlib import Path
from shutil import rmtree
mmarkk@mmwork:/mnt/cephfs$ stat tgg
File: tgg
Size: 17 Blocks: 0 IO Block: 65536 directory
Device: 0h/0d Inode: 1099514016396 Links: 15
Access: (0700/drwx------) Uid: ( 1000/ mmarkk) Gid: ( 0/ root)
Access: 2019-02-04 23:06:19.636671000 +0500
Modify: 2019-09-16 18:28:18.295697000 +0500
Change: 2019-09-16 18:28:18.295697000 +0500
Birth: -
mmarkk@mmwork:/mnt/cephfs$ cd .snap