Skip to content

Instantly share code, notes, and snippets.

// This is a random access iterator similar to boost::counting_iterator for use with
// parallel algorithms. It's probably not necessary to have random access or overflow
// checking. More testing needed, but useful as a snippet.
#include <compare>
#include <concepts>
#include <exception>
#include <iterator>
#include <cstddef>
#include <fmt/format.h>
#include <range/v3/view.hpp>
#include <vector>
struct event {
int created = 0;
int status = 0;
};
std::vector<event> create_events() {
// https://en.cppreference.com/w/cpp/thread/shared_mutex
// https://godbolt.org/z/eoqErv
#include <iostream>
#include <shared_mutex>
#include <thread>
#include <vector>
int g_value = 0;
std::shared_mutex g_mutex;
@qis
qis / office.md
Last active November 28, 2020 12:54
Microsoft Office

Microsoft Office

Install Microsoft Office and Language Packs.

General
+ Privacy Settings
  [Privacy Settings...]
  + Optional diagnostic data
    ☐ Send additional diagnostic and usage data to Microsoft
  + Connected experiences
@qis
qis / components.cpp
Last active November 27, 2020 17:58
C++ component system with a singleton registry.
// ============================================================================
// component.hpp
// ============================================================================
#pragma once
#include <typeindex>
#include <cstddef>
class component_manager {
template <typename T>
friend class component;
file(MAKE_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/data
${CMAKE_CURRENT_BINARY_DIR}/temp)
add_executable(icupkg src/source/tools/icupkg/icupkg.cpp)
target_compile_options(icupkg PRIVATE ${compile_options})
target_compile_definitions(icupkg PRIVATE ${compile_definitions})
target_link_libraries(icupkg PRIVATE dt_stub uc in io tu)
add_custom_target(data ALL DEPENDS icupkg COMMAND $<TARGET_FILE:icupkg>
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
project(icu VERSION 68.1 LANGUAGES C CXX)
# Library: icudt
file(GLOB dt_sources src/source/stubdata/*.cpp)
add_library(dt SHARED ${headers} ${dt_sources})
set_target_properties(dt PROPERTIES OUTPUT_NAME "icudt" INSTALL_RPATH "$ORIGIN")
# Library: icuuc
file(GLOB uc_sources src/source/common/*.cpp)
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
project(icu VERSION 68.1 LANGUAGES C CXX)
#set(ICU_VER "${PROJECT_VERSION_MAJOR}-${PROJECT_VERSION_MINOR}")
#set(ICU_URL "https://github.com/unicode-org/icu/archive/release-${ICU_VER}.tar.gz")
#set(ICU_SHA "5b3cfb519c20511c1c0429b093ec16960f6a6a0d7968a9065fda393f9eba48fc")
#download(${ICU_URL} ${ICU_SHA} src)
set(ICU_DIR "release-${PROJECT_VERSION_MAJOR}-${PROJECT_VERSION_MINOR}")
set(ICU_TAR "icu4c-${PROJECT_VERSION_MAJOR}_${PROJECT_VERSION_MINOR}-src.tgz")
#include <windows.h>
#include <filesystem>
#include <iostream>
#include <sstream>
#include <string>
int main(int argc, char* argv[]) {
// Report command and parameter lengths.
if (argc > 1) {
std::cout