Skip to content

Instantly share code, notes, and snippets.

@qis
qis / sink.hpp
Created January 22, 2020 15:56
Custom spdlog sink.
#pragma once
#include <fmt/color.h>
#include <spdlog/details/pattern_formatter.h>
#include <spdlog/sinks/sink.h>
class sink : public spdlog::sinks::sink {
public:
sink(spdlog::color_mode mode = spdlog::color_mode::automatic) {
styles_[spdlog::level::trace] = fmt::fg(fmt::terminal_color::bright_black) | fmt::emphasis::bold;
styles_[spdlog::level::debug] = fmt::fg(fmt::terminal_color::bright_white) | fmt::emphasis::bold;
@qis
qis / freebsd.md
Last active August 25, 2023 11:46
Installation and setup instructions for FreeBSD

FreeBSD

Installation template for FreeBSD RELEASE, STABLE and CURRENT.

Distribution Select

[ ] doc
[*] src (for building ports)

Microsoft Edge

Install Microsoft Edge and configure edge://settings.

Privacy and services
+ Privacy
  Allow sites to check if you have payment methods saves: Off
+ Services
  Use a web service to help resolve navigation errors: Off
  Suggest similar sites when a website can't be found: Off
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")
// 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>
@qis
qis / regex.cpp
Last active June 6, 2022 10:50
// ------------------------------------------------------------------------
// Benchmark LGCG Time LTO Time Iterations LTCG Build LTO Build
// ------------------------------------------------------------------------
// regex_boost 317 ns 69.1 ns 2133333 00:02.720 00:08.70
// regex_ctre 248 ns 4.79 ns 2800000 05:08.755 00:04.78
// regex_hyperscan 96.7 ns n/a 7466667 00:52.487 n/a
// regex_re2 186 ns 3.97 ns 4072727 00:03.353 00:05.94
// regex_spirit 44.3 ns 0.644 ns 15448276 00:03.487 00:05.25
// regex_std 2371 ns 67.2 ns 280000 00:02.442 00:05.54
// regex_xpressive 552 ns 273 ns 1000000 00:05.369 00:11.52
@qis
qis / parse_date.h
Last active April 5, 2022 05:50
Parse ISO 8601 date time strings in C++ and AVX2.
// if(MSVC)
// set(AVX2_FLAGS "/arch:AVX2")
// else()
// set(AVX2_FLAGS "-march=native -mavx2")
// endif()
//
// option(ENABLE_AVX2 "Enable AVX2 support" OFF)
// if(ENABLE_AVX2)
// if(CMAKE_CROSSCOMPILING)
// set(AVX2 TRUE)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"/>
# Clang-Tidy Configuration
---
Checks: "-*,\
clang-analyzer-*,\
-clang-analyzer-deadcode.DeadStores,\
clang-diagnostic-*,\
bugprone-*,\
-bugprone-dynamic-static-initializers,\
-bugprone-forward-declaration-namespace,\
-bugprone-macro-parentheses,\
# Clang-Format Configuration
---
BasedOnStyle: LLVM
# Indent
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
IndentPPDirectives: AfterHash
IndentWrappedFunctionNames: false