Skip to content

Instantly share code, notes, and snippets.

View scivision's full-sized avatar
💭
I will be slow to respond.

scivision

💭
I will be slow to respond.
View GitHub Profile
@scivision
scivision / .flake8
Last active September 22, 2025 03:29
inhibit Windows from suspend/sleep while subprocess is running
[flake8]
max-line-length = 100
@WardBrian
WardBrian / BoostUT.cmake
Last active September 22, 2025 03:49
CTest registration for Boost.UT. License: BSD-3-Clause
FetchContent_Declare(boost_ut
GIT_REPOSITORY https://github.com/boost-ext/ut.git
GIT_TAG v2.3.1)
FetchContent_MakeAvailable(boost_ut)
# link this object to your test executable, then call discover_boost_ut_test() on it
add_library(boost_ut_runner OBJECT test_runner.cpp)
target_link_libraries(boost_ut_runner PUBLIC Boost::ut)
@scivision
scivision / Readme.md
Last active August 26, 2025 14:22
Quickly upload WSJT-X default log to LoTW using TQSL
@scivision
scivision / CMakeLists.txt
Last active August 10, 2025 22:40
Identify if CPU is x86_64v3 capable
cmake_minimum_required(VERSION 3.19...4.2)
project(InstructionSet LANGUAGES CXX)
set(CMAKE_CXX_SCAN_FOR_MODULES OFF)
enable_testing()
include(CheckIncludeFileCXX)
@scivision
scivision / Readme.md
Last active July 11, 2025 21:56
Intel oneAPI GitHub Actions (with caching) MKL and MPI (C, C++, Fortran) and CMake

GitHub Actions Intel oneAPI with caching

Using GitHub Actions cache is a little more complicated than not caching, but makes the setup time dramatically shorter.

This example uses MKL and MPI.

To avoid problems with the CI executing the scripts, do one time:

@scivision
scivision / extract_zst.py
Last active August 18, 2025 14:44
Extract a .zst file in Python
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.9"
# dependencies = ["zstandard; python_version < '3.14'"]
# ///
"""
https://docs.python.org/3.14/library/compression.zstd.html#compression.zstd.ZstdFile
"""
@scivision
scivision / _redirects
Last active February 15, 2021 08:40
Netlify public/_redirects for bot log diversion
# This file is for use with a Hugo blog.
# be careful using this on real-life site, so that the patterns below don't dump legitimate traffic!
# we use 410 to be more aggressive than 404, and to unclutter Netlify statistics
/.env /bot.html 410
/blog.zip /bot.html 410
/.git/* /bot.html 410
/browserconfig.xml /bot.html 410
/OLD/* /bot.html 410
/404.html /bot.html 410
@shafik
shafik / WhatIsStrictAliasingAndWhyDoWeCare.md
Last active September 26, 2025 09:54
What is Strict Aliasing and Why do we Care?

What is the Strict Aliasing Rule and Why do we care?

(OR Type Punning, Undefined Behavior and Alignment, Oh My!)

What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.

In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.

Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th

@mbinna
mbinna / effective_modern_cmake.md
Last active October 13, 2025 02:08
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@JonathonReinhart
JonathonReinhart / SConstruct
Last active September 27, 2025 22:20
mkdir -p implemented in C
env = Environment(
CCFLAGS = ['-Wall', '-Werror'],
)
env.Program('mkdir_p_test', ['mkdir_p.c', 'test.c'])