Skip to content

Instantly share code, notes, and snippets.

View khlus's full-sized avatar

Dzmitry Khlus khlus

View GitHub Profile
@khlus
khlus / nginx.conf
Last active August 24, 2018 17:53
Nginx config to receive long stream
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name localhost;
location / {
@khlus
khlus / server.cpp
Last active September 24, 2023 13:47
Unix domain sockets + select + pthread
#include <stdio.h>
#include <stdint.h>
#include <string.h> //strlen
#include <stdlib.h>
#include <errno.h>
#include <unistd.h> //close
#include <sys/un.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#pragma once
//BOOST
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/indexed_by.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/identity.hpp>
#include <boost/multi_index/mem_fun.hpp>
#include <boost/multi_index/composite_key.hpp>
boost::filesystem::wpath path = boost::filesystem::current_path();
path /= L"..\\..\\..\\SecureTowerTestData\\WorkstationIndexerTest\\FgStEPADigestSetCasheExample.xml";
std::vector<char> fileData;
boost::iostreams::stream<boost::iostreams::file_source> src{ boost::iostreams::file_source(path.string()) };
boost::iostreams::back_insert_device<std::vector<char>> sink{ fileData };
boost::iostreams::stream<boost::iostreams::back_insert_device<std::vector<char>>>(sink) << src.rdbuf() << std::flush;
@khlus
khlus / LICENSE.md
Last active August 29, 2015 14:24 — forked from tarqd/LICENSE.md

The MIT License (MIT)

Copyright (c) 2015 Christopher Tarquini

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@khlus
khlus / ip_allocator.cpp
Last active May 3, 2018 11:02
Vector allocated on Memory Mapped Files
/* Boost.MultiIndex example of use of Boost.Interprocess allocators.
*
* Copyright 2003-2008 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* See http://www.boost.org/libs/multi_index for library home page.
*/
#pragma once
//STL
#include <fstream>
//BOOST
#include <boost/iostreams/device/mapped_file.hpp>
#include <boost/filesystem.hpp>
#include "HashAlgoritm.hpp"