This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <typeinfo> | |
#include <unordered_map> | |
class Foo { | |
public: | |
void dump() { printf("Hello, foo!\n"); } | |
}; | |
class Bar { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <typeinfo> | |
#include <unordered_map> | |
class Foo { | |
public: | |
void dump() { printf("Hello, foo!\n"); } | |
}; | |
class Bar { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim:syntax=flow | |
import accesslog from 'x0d/plugins'; | |
import director from 'x0d/plugins/director'; | |
import access from 'x0d/plugins'; | |
import status from 'x0d/plugins'; | |
import auth from 'x0d/plugins'; | |
handler setup { | |
# workers 4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /bin/bash | |
# depends: libgeoip-dev libpcre3-dev libpam-dev | |
version="1.7.1" | |
wget -O /tmp/nginx-${version}.tar.gz http://nginx.org/download/nginx-${version}.tar.gz && | |
wget -O /tmp/nginx-auth-pam.tar.gz http://web.iti.upv.es/~sto/nginx/ngx_http_auth_pam_module-1.3.tar.gz && \ | |
git clone git@github.com:giom/nginx_accept_language_module.git /var/tmp/nginx_accept_language_module && | |
tar xzvpf /tmp/nginx-${version}.tar.gz -C /var/tmp/ && |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <xzero/Server.h> | |
#include <xzero/ConnectionFactory.h> | |
#include <xzero/Connection.h> | |
#include <xzero/LocalConnector.h> | |
#include <xzero/SequencedExecutor.h> | |
#include <base/Buffer.h> | |
using base::Buffer; | |
class EchoConnection : public xzero::Connection { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <functional> | |
#include <memory> | |
#include <stdio.h> | |
typedef std::function<void()> Task; | |
void onRead() { printf("onRead\n"); } | |
void onTimeout() { printf("onTimeout\n"); } | |
void wait(void* ep, Task&& onRead, Task&& onWrite, Task&& onTimeout) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <xzero/Api.h> | |
namespace xzero { | |
class XZERO_API LogTarget { | |
public: | |
virtual ~LogTarget() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <xzero/Api.h> | |
/* | |
* <xzero/logging/...> | |
* LogSource the logging source, that initiates/triggers the log msgs | |
* LogLevel the log level (none, error, warn, info, debug) | |
* LogTarget the logging target, where to log to | |
* LogAggregator logging aggregator, that manages the sources and their target. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <arpa/inet.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <netdb.h> | |
#include <getopt.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Executor { | |
public: | |
typedef std::function<void()> Task; | |
virtual void execute(Task task) = 0; | |
protected: | |
void setExceptionHandler(std::function<void(const std::exception&)> eh); | |
void handleException(const std::exception& e); | |
void safeCall(Task task) noexcept; // auto-catch any possibly exception |
OlderNewer