Skip to content

Instantly share code, notes, and snippets.

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

Vladislav Antonov vladiant

🏠
Working from home
View GitHub Profile
@vladiant
vladiant / adr.txt
Created April 20, 2025 06:46
Architecture Decision Records
Why Documenting Architecture Decisions Matters
1. A Single Source of Truth
2. Better Onboarding and Cross-Team Collaboration
3. Encourage Thoughtful, Data-Driven Decisions
4. Simplify Architecture Evolution
ADRs are meant to capture key decisions that have long-term implications for your system or organization. If a decision introduces a new dependency, alters fundamental data flows, or significantly affects architecture and team processes, it likely requires an ADR.
On the other hand, minor decisions - like tweaking a library version or refactoring a single function usually don’t need an official record.
@vladiant
vladiant / crtp.cpp
Created April 8, 2025 18:10
C++26: variadic friends
// The base class
template<class Crtp, class MsgT>
class Receiver {
void receive(MsgT) {
static_cast<Crtp*>(this)->private_ += 1;
}
};
// The derived class
@vladiant
vladiant / template_metaprogramming_helpers.cpp
Created April 8, 2025 18:00
Tiny C++ template metaprogramming helpers
// https://vawale.github.io/posts/template_metaprogramming_helpers/
template<typename... Args>
consteval auto count() {
return sizeof...(Args);
}
template<template <typename T> typename Predicate, typename... Args>
consteval auto count_if() -> size_t {
return (0 + ... + Predicate<Args>{}());
@vladiant
vladiant / Makefile
Created April 6, 2025 19:38
Simple C++ Makefile
##################################################
## ##
## Simple Universal C/C++ Makefile v2.0 ##
## ##
##################################################
##################################################
## GLOBAL CONFIGURATION ##
##################################################
@vladiant
vladiant / atomic_thread_fence.cpp
Last active March 2, 2025 07:26
C++ Threads Memory Order
#include <atomic>
#include <string>
#include <thread>
#include <iostream>
// Global
std::string computation(int a){
return std::to_string(a);
}
@vladiant
vladiant / link.txt
Last active February 1, 2025 07:36
C+ Type erasure
@vladiant
vladiant / variant_performance.cpp
Created March 16, 2023 18:17
"Clean" Code, Horrible Performance and the forgotten variant
// https://www.reddit.com/r/cpp/comments/11rzncu/clean_code_horrible_performance_and_the_forgotten/
// https://quick-bench.com/q/mW30pqwTvtWZ-aT6COu1oiUycYc
#include <cmath>
#include <cstdlib>
#include <cstddef>
#include <ctime>
#include <memory>
#include <variant>
#include <vector>
@vladiant
vladiant / shared_mem_example.cpp
Created October 9, 2022 19:29
Processes or Threads?
// https://lucisqr.substack.com/p/processes-or-threads
// https://github.com/Vitorian/MyPasteBin/blob/master/shared_mem_example.cpp
#include <atomic>
#include <fcntl.h>
#include <new>
#include <stdio.h>
#include <string.h>
#include <sys/file.h>
#include <sys/mman.h>
@vladiant
vladiant / client.cpp
Created June 23, 2022 19:36
C++ TCP Examples
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>
#include <iostream>
using namespace std;
// Defining Port, Note that port is same on which server is listening and on
// which we want to connect
@vladiant
vladiant / CMakeLists.txt
Created June 14, 2022 17:25
StoreRLValue
cmake_minimum_required(VERSION 3.10)
project(StoreRLValue)
add_executable(
${PROJECT_NAME}
main.cpp
)
set_target_properties(