Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
/*- | |
* Copyright (c) 2014 Taylor R. Campbell | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions | |
* are met: | |
* 1. Redistributions of source code must retain the above copyright | |
* notice, this list of conditions and the following disclaimer. | |
* 2. Redistributions in binary form must reproduce the above copyright |
/* Copyright (c) 2018 Arvid Gerstmann. */ | |
/* This code is licensed under MIT license. */ | |
#ifndef AG_RANDOM_H | |
#define AG_RANDOM_H | |
class splitmix | |
{ | |
public: | |
using result_type = uint32_t; | |
static constexpr result_type (min)() { return 0; } |
#include <cstdint> | |
#include <iostream> | |
#include <tuple> | |
#include <type_traits> | |
template <typename T> | |
using unsigned_of = std::conditional_t< | |
(sizeof(T) == 1), uint8_t, | |
std::conditional_t<(sizeof(T) == 2), uint16_t, | |
std::conditional_t<(sizeof(T) == 4), uint32_t, |
#include <cstdio> | |
#include <chrono> | |
#include <cinttypes> | |
#include <ctime> | |
struct YMD | |
{ | |
int y{}; | |
unsigned m{}; | |
unsigned d{}; |
#include <string> | |
#include <fmt/format.h> | |
#include <fmt/printf.h> | |
namespace details | |
{ | |
#define ERROR_MESSAGES(X) \ | |
X(DivByZero) \ | |
X(NumOverflow) \ |
// (C) eric niebler | |
#include <type_traits> | |
#define CAT_(X, ...) X ## __VA_ARGS__ | |
#define CAT(X, ...) CAT_(X, __VA_ARGS__) | |
#define RETURN(...) return_t<__VA_ARGS__, std::enable_if_t<RETURN_ | |
#define RETURN_(...) CAT(RETURN_, __VA_ARGS__)>> | |
#define RETURN_requires |
// fine for string_view or const char*. todo: use std::forward | |
// from Marco Magdy | |
template<typename.. Args> | |
auto strcat(Args... args) | |
{ | |
const auto total = (... + args.size()); | |
std::string s; | |
s.reserve(total); | |
(s += ... += args); | |
return s; |
template <typename InputIt, typename OutputIt> | |
OutputIt | |
radix_sort_split(InputIt first, InputIt last, OutputIt output, std::uint64_t bit) | |
{ | |
std::vector<std::uint64_t> e(std::distance(first, last)); | |
// Count 0s. | |
std::transform(first, last, e.begin(), | |
[=] (auto t) { return !(t & (1 << bit)); }); |
template <typename InputIt, typename OutputIt, typename BinaryOp, typename T, typename Size> | |
unique_future<OutputIt> | |
async_inclusive_scan(InputIt first, InputIt last, OutputIt output,BinaryOp op, T init, Size chunk_size) | |
{ | |
Size const elements = std::distance(first, last); | |
Size const chunks = (1 + ((elements - 1) / chunk_size)); // Round up. | |
std::vector<unique_future<T>> sweep; | |
sweep.reserve(chunks); |