Skip to content

Instantly share code, notes, and snippets.

View mpapierski's full-sized avatar

Michał Papierski mpapierski

View GitHub Profile
#include <iostream>
#include <string>
#include <stdexcept>
#include <fstream>
#include <memory>
struct stop : std::runtime_error
{
stop() : std::runtime_error("nie dla psa xD") {}
};

Keybase proof

I hereby claim:

  • I am mpapierski on github.
  • I am mpapierski (https://keybase.io/mpapierski) on keybase.
  • I have a public key whose fingerprint is 4D58 E8BC 76A4 A993 5CDD F21C 136D AA18 A11D 9ED9

To claim this, I am signing this object:

#include "http-server/http-server.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <strings.h>
#include <string.h>
typedef struct
{
char body[1024];
#include "http-server/http-server.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
void http_server_string_init(http_server_string * str)
{
assert(str);
str->buf = NULL;
#include <cassert>
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
extern "C" {
#include "http-server/http-server.h"
}
struct http_error_category
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <uv.h>
#include "http-server/http-server.h"
uv_loop_t * loop;
http_server srv;
http_server_handler handler;
input {
tcp {
port => 55555
type => syslog
}
udp {
port => 55555
type => syslog
}
}
@mpapierski
mpapierski / main.cpp
Created June 23, 2014 22:06
boost.asio and custom coroutines experiment
#include <vector>
#include <iostream>
#include <future>
#include <boost/optional.hpp>
#include <boost/filesystem.hpp>
#include <boost/thread.hpp>
#include <boost/asio.hpp>
#include <boost/asio/use_future.hpp>
#include <boost/asio/spawn.hpp>
struct scheduler
@mpapierski
mpapierski / channels.cpp
Created April 26, 2014 12:46
C++ by example - Channels
#include <iostream>
#include <cassert>
#include <boost/asio.hpp>
#include <boost/thread.hpp>
constexpr int NTASK = 50;
int
main()
{
@mpapierski
mpapierski / gist:10603999
Created April 13, 2014 21:56
This is how you handle SIGINT as explained in http://www.cons.org/cracauer/sigint.html
#include <iostream>
#include <boost/asio.hpp>
// http://www.cons.org/cracauer/sigint.html
void
signal_handler(const boost::system::error_code & ec, int signal_number)
{
assert(signal_number == SIGINT);
std::cerr << "Received SIGINT" << std::endl;