Skip to content

Instantly share code, notes, and snippets.

icylord /
Created Feb 9, 2018 — forked from ArtemGr/
liblzma: compress (g)string into (g)string
#include <lzma.h> //
#include <memory> // unique_ptr
#include <stdexcept> // runtime_error
#include <glim/gstring.hpp> // Here glim::gstring can be replaced with std::string.
using glim::gstring;
static void xzCompress (const gstring& from, gstring& to) {
// See also LZMA example at:;a=blob;f=doc/examples/01_compress_easy.c
lzma_stream strm = LZMA_STREAM_INIT;
std::unique_ptr<lzma_stream, void(*)(lzma_stream*)> freeStream (&strm, lzma_end);
View benchmark_asio.cpp
#include <asio.hpp>
#include <asio/ssl.hpp>
#include <algorithm>
#include <atomic>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <memory>
#include <thread>
icylord / client.cpp
Created Sep 24, 2017 — forked from yayj/client.cpp
ASIO ping-pong test modification for io_service per thread.
View client.cpp
// client.cpp
// ~~~~~~~~~~
// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at
View C++世界里那些“牛人”的个人博客.md




icylord / Makefile
Created Jun 24, 2017 — forked from sehe/Makefile
Boost shared memory lockfree circular buffer queue
View Makefile
all:consumer producer
CPPFLAGS+=-std=c++03 -Wall -pedantic
CPPFLAGS+=-isystem ~/custom/boost/
LDFLAGS+=-L ~/custom/boost/stage/lib/ -Wl,-rpath,/home/sehe/custom/boost/stage/lib
LDFLAGS+=-lboost_system -lrt -lpthread
View cluster
// generate [0..n-1]
auto seq = [](size_t n) -> std::vector<size_t> {
std::vector<size_t> v(n);
for (size_t i=0; i<n; ++i) v[i] = i;
return v;
auto index = seq(n);
// n * n distance matrix
std::vector<D> dists(n * n);
You can’t perform that action at this time.