Skip to content

Instantly share code, notes, and snippets.

@mpapierski
mpapierski / asio_sendfile.cpp
Last active November 7, 2021 19:36
boost.asio + sendfile(2)
// how to use boost.asio + sendfile(2)
// Michał Papierski <michal@papierski.net>
#include <iostream>
#include <string>
#include <boost/asio.hpp>
#include <boost/make_shared.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/ref.hpp>
#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
@splinterofchaos
splinterofchaos / monad-parser.cpp
Created November 19, 2012 17:32
Monadic parsing in C++
#include <memory>
#include <iostream>
#include <sstream>
#include <utility>
#include <algorithm>
#include <iterator>
struct sequence_tag {};
struct pointer_tag {};
@ebouchut
ebouchut / LighttpdReverseProxyURLRewriting
Last active January 27, 2021 20:35
Lighttpd reverse-proxy to that matches an URL _and_ does URL rewriting #web #server #lighttpd
#server.modules += ( "mod_rewrite")
# Workaround to have a working reverse-proxy that matches an URL does URL rewriting in Ligghtpd.
#
# Ligtthpd 1.4.28 cannot perform both matching and URL rewriting at the same time.
# Therefore we need to define 2 proxies, one does the matching and bounce the request
# to the other one, in charge of rewriting the URL before proxying the request to the target server.
#
# More about this here:
# http://redmine.lighttpd.net/issues/164#note-9