Skip to content

Instantly share code, notes, and snippets.

View testillano's full-sized avatar

Eduardo Ramos Testillano testillano

View GitHub Profile
@testillano
testillano / docker-compose.yml
Last active April 16, 2024 12:45
http2 load balancer using docker-compose
version: '3'
services:
h2a:
image: ghcr.io/testillano/h2agent_http1:4.2.5
hostname: h2a
#expose:
# - "8001"
ports:
# Ephemeral (use 'docker-compose ps' to see them)
@testillano
testillano / safe-file.cc
Last active July 18, 2022 07:10
SafeFile with close delayed and max files opened control
///////////////////////////////////////////////////////////////
// Safe file: allow safe writting of text/binary files.
// Close delay configurable.
// Max opened files controlled by condition variable.
//
// LINK: g++ main.cc -l pthread -l boost_system -l boost_thread
///////////////////////////////////////////////////////////////
#include <iostream>
#include <thread>
#include <vector>
#include <iterator>
#include <iostream>
#include <sstream>
#include <string>
#include <string.h>
#include <memory>
#include <sys/time.h>
const int maxChunkSize = 32000;
@testillano
testillano / asio-sv3-without-queue.cc
Last active June 30, 2022 00:10
asio-sv3 simplified (without Queue for worker threads)
#include <iostream>
#include <string>
#include <mutex>
#include <thread>
#include <future>
#include <deque>
#include <nghttp2/asio_http2_server.h>
using namespace nghttp2::asio_http2;
#include <iostream>
#include <string>
#include <mutex>
#include <thread>
#include <future>
#include <deque>
#include <memory>
#include <sstream>
#include <nghttp2/asio_http2_server.h>