Skip to content

Instantly share code, notes, and snippets.

View madhur4127's full-sized avatar
👋

Madhur Chauhan madhur4127

👋
View GitHub Profile
@madhur4127
madhur4127 / iouring.cpp
Last active January 19, 2024 18:45
io_uring with multishot recv in C++20
#include <liburing.h>
#include "expected.hpp"
#include <cassert>
#include <cstddef>
#include <cstring>
#include <functional>
#include <iostream>
#include <memory>
#include <set>
@madhur4127
madhur4127 / MsgsBuffer.cpp
Last active December 22, 2022 09:38
Flat Variable length Message Buffer in C++20 - Efficient alternative to std::queue<std::vector<...>> / std::queue<std::string> etc..
#include "MsgsBuffer.h"
#include <cassert>
#include <cstring>
#include <numeric>
#include <stdexcept>
MsgsBuffer::MsgsBuffer(std::span<std::byte> buf)
: mBuf{buf.data()}, mCapacity(buf.size_bytes()) {
if (buf.size_bytes() > std::numeric_limits<int32_t>::max()) {
@madhur4127
madhur4127 / asio.md
Created December 20, 2022 04:46
Awesome Asio (links to tutorials, articles, blogs etc)
@madhur4127
madhur4127 / GCC_INF_LOOP.cpp
Last active June 6, 2020 13:55
Infinite loop and high memory usage in GCC
#include "bits/stdc++.h"
using namespace std;
/////////////////// TYPES & MACROS ///////////////////////////////
#define all(x) x.begin(), x.end()
#define exist(s, e) (s.find(e) != s.end())
using i64 = int64_t;
using i32 = int32_t;
const char el = '\n';
template <class T>