Skip to content

Instantly share code, notes, and snippets.

@s2x
s2x / php_ampq_async.php
Created May 18, 2025 17:32
Async consume using PHP amqp extension
<?php
//Establish connection AMQP
$connection = new AMQPConnection();
$connection->setHost('172.17.0.2');
$connection->setLogin('guest');
$connection->setPassword('guest');
$connection->setReadTimeout(1);
$connection->connect();
@s2x
s2x / MemcachedSessionHandler.php
Created February 7, 2019 20:13
Memcached session handler - with option to change expiration time per key, and after session_start
<?php
class MemcachedSessionHandler implements \SessionHandlerInterface {
/**
* @var Memcached
*/
private $memcached;
private $timeout = 0;
@s2x
s2x / goat_zero.cpp
Created February 28, 2018 21:04
Simple Boost Beast multi-threaded http server
//------------------------------------------------------------------------------
//
// Example: HTTP server
//
//------------------------------------------------------------------------------
#include <boost/beast/core.hpp>
#include <boost/beast/http.hpp>
#include <boost/asio.hpp>
#include <boost/filesystem.hpp>