Skip to content

Instantly share code, notes, and snippets.

@ecorm
ecorm / client.cpp
Created October 23, 2023 21:27
Close Beast websocket immediately after async_write_some
//
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
//
// 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)
//
// Official repository: https://github.com/boostorg/beast
//
//------------------------------------------------------------------------------
@ecorm
ecorm / client.cpp
Created October 23, 2023 20:10
Close Beast Websocket During Partial Write
//
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
//
// 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)
//
// Official repository: https://github.com/boostorg/beast
//
//------------------------------------------------------------------------------
@ecorm
ecorm / main.cpp
Last active July 31, 2021 22:29
Parsing arbitrary ISO 8601 timestamp into arbitrary time_point
#include <iostream>
#include <date/h>
//------------------------------------------------------------------------------
template <typename Clock>
struct clock_traits
{};
template <>
struct clock_traits<std::chrono::system_clock>
@ecorm
ecorm / gist:3b5963749752f2cc2f96fb493d29fcba
Last active January 4, 2021 23:04
16-bit IEEE float test vectors
Released under the Unlicence: https://unlicense.org/
bijective half <-> float/double conversions
-------------------------------------------
{
// --------- little endian bits ---------
// scenario decimal approx half float double
{"(+) infinity", infinity, 0x7C00, 0x7F800000, 0x7FF0000000000000},
{"(+) largest normal", 65504.0f, 0x7BFF, 0x477FE000, 0x40EFFC0000000000},