Skip to content

Instantly share code, notes, and snippets.

View qrealka's full-sized avatar

Dmitry Loginov qrealka

View GitHub Profile
@qrealka
qrealka / meson.build
Created February 6, 2025 14:18 — forked from HE-Wenjian/meson.build
meson dependency searching with Conan
#############################################
# -----------
# Import from conan only.
# -----------
conan_pkgs= {
'fmt':'fmt/5.3.0@', # <- Must contain @, otherwise Conan will think it is a path
# ... the dependency list goes on
}
# Adding new dependencies to this dict is error-free, but if you
#!/usr/bin/env bash
function register_clang_version {
local version=$1
local priority=$2
update-alternatives \
--verbose \
--install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-${version} ${priority} \
--slave /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-${version} \
@qrealka
qrealka / TSAN.txt
Last active January 27, 2025 17:19
dvloginov@dvloginov-vbox:~/work/dpdk_ring_tsan$ meson test -v -C buildDir
ninja: no work to do.
ninja: Entering directory `/home/dvloginov/work/dpdk_ring_tsan/buildDir'
ninja: no work to do.
1/1 rint_tst RUNNING
>>> MALLOC_PERTURB_=164 /home/dvloginov/work/dpdk_ring_tsan/buildDir/dpdk_ring_tsan --no-pci --no-hpet --no-huge --no-shconf --log-level=lib.eal:debug '-m 1024'
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
==75767==Installed the sigaction for signal 11
==75767==Installed the sigaction for signal 7
==75767==Installed the sigaction for signal 8
@qrealka
qrealka / Makefile
Created May 7, 2024 12:07 — forked from skeeto/Makefile
C Object Oriented Programming Example
CFLAGS = -std=c99 -Wall
main : main.o
.PHONY : test clean
test : main
./$^ "*regex*" "*vtable*" < main.c
clean :
@qrealka
qrealka / main.go
Last active February 22, 2024 12:51
PoC half-auto OTEL metrics creation
package main
import (
"context"
"fmt"
"log"
"sync/atomic"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/metric"
@qrealka
qrealka / add.sh
Created October 26, 2020 19:50 — forked from ArseniyShestakov/add.sh
My compiler alternatives
# Cleanup old alternatives
update-alternatives --remove-all cc
update-alternatives --remove-all c++
update-alternatives --remove-all gcc
update-alternatives --remove-all g++
update-alternatives --remove-all clang
update-alternatives --remove-all clang++
update-alternatives --remove-all icc
update-alternatives --remove-all icc++
@qrealka
qrealka / cpp.std.coroutines.draft.md
Created June 15, 2020 10:52 — forked from MattPD/cpp.std.coroutines.draft.md
C++ links: Coroutines (WIP draft)
@qrealka
qrealka / inplace_rle.cpp
Created May 5, 2020 00:09
leetcode inplace rle
class Solution {
public:
int compress(vector<char>& chars) {
int n = chars.size();
if (n <= 1) return n;
int j = 0, i = 0;
while (i < n) {
int k = i;
// skip duplicates
while ((k + 1 < n) && chars[k] == chars[k + 1]) {
@qrealka
qrealka / rle_encode.cpp
Created May 5, 2020 00:02
c++ RLE encoding
string compression(const string & str){
int i = str.size();
string letters;
for (int j = 0; j < i; ++j){
int count = 1;
while (str[j] == str[j+1]){
count++;
j++;
}
@qrealka
qrealka / refl_compare.cpp
Created February 17, 2020 10:06
compare generic struct
// based on https://stackoverflow.com/a/60080443
#define RETURNS(...) \
noexcept(noexcept(__VA_ARGS__)) \
-> decltype(__VA_ARGS__) \
{ return __VA_ARGS__; }
template<class T,
typename std::enable_if< !std::is_class<T>{}, bool>::type = true
>