Skip to content

Instantly share code, notes, and snippets.

@edouarda
edouarda / port_win.cc
Last active May 3, 2023 11:47
Better Win32 port for RocksDB - as used in Quasar (https://www.quasar.ai)
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
//
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#if defined(OS_WIN)
import pandas as pd
import numpy as np
import multiprocessing as mp
from functools import partial
def _gen_df(per_chunk, step, out, i):
print("generating df " + str(i) + " with " + str(per_chunk) + " rows..")
start_time = np.datetime64('1990-01-01', 'ns') + np.timedelta64(i * per_chunk, step)
idx = np.array([(start_time + np.timedelta64(i, step))
for i in range(per_chunk)]).astype('datetime64[ns]')
#include <boost/asio.hpp>
#include <iostream>
class session : public std::enable_shared_from_this<session>
{
public:
explicit session(boost::asio::ip::tcp::socket && s)
: _socket{std::move(s)}
{}
#include <boost/asio.hpp>
#include <iostream>
int main(int, char **)
{
boost::asio::io_context context;
auto ip = boost::asio::ip::address::from_string("127.0.0.1");
auto ep = boost::asio::ip::tcp::endpoint{ip, 8080};
#include <boost/asio.hpp>
#include <iostream>
int main(int argc, char ** argv)
{
try
{
boost::asio::io_context io_context;
boost::asio::ip::udp::socket s{io_context,
#include <boost/asio.hpp>
#include <iostream>
int main(int, char **)
{
boost::asio::io_context context;
const boost::asio::ip::udp::endpoint ep{boost::asio::ip::udp::v4(), 8080};
boost::asio::ip::udp::socket s{context, ep};
#include <boost/asio.hpp>
#include <iostream>
int main(int argc, char ** argv)
{
try
{
boost::asio::io_context io_context;
boost::asio::ip::tcp::socket s{io_context};
#include <boost/asio.hpp>
#include <iostream>
int main(int, char **)
{
boost::asio::io_context context;
auto ip = boost::asio::ip::address::from_string("127.0.0.1");
auto ep = boost::asio::ip::tcp::endpoint{ip, 666};
//
// chat_client.cpp
// ~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 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 http://www.boost.org/LICENSE_1_0.txt)
//
//
// chat_server.cpp
// ~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 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 http://www.boost.org/LICENSE_1_0.txt)
//