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 / Readme.md
Last active July 10, 2025 14:08
Quickly upload WSJT-X default log to LoTW
@scivision
scivision / CMakeLists.txt
Last active July 20, 2025 21:39
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 December 13, 2024 12:20
Extract a .zst file in Python
from pathlib import Path
import tempfile
import tarfile
import zstandard
# pip install zstandard
def extract_zst(archive: Path, out_path: Path):
"""extract .zst file
@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 July 19, 2025 23:36
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 July 20, 2025 14:17
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 May 19, 2025 04:39
mkdir -p implemented in C
env = Environment(
CCFLAGS = ['-Wall', '-Werror'],
)
env.Program('mkdir_p_test', ['mkdir_p.c', 'test.c'])
@natefoo
natefoo / 00README.md
Last active June 14, 2025 11:01
Linux Distribution Detection

Distribution Detection

I am working on adding support for building and distributing (via PyPI) Python Wheels with C Extensions to the Python wheel and pip packages. The discussion on Distutils-SIG continues, but I believe it is fairly certain that some effort to correctly identify Linux distributions will need to be made. I've begun efforts to add this support to wheel.

How you can help

If you have a Linux distribution or version of a listed distribution not in this gist, or one of the ones I have not directly verified, I could use the following:

  • The contents of /etc/os-release, if it exists
@jyalim
jyalim / build-hdf5.sh
Last active March 7, 2025 16:51
Build HDF5 with Intel Compilers
#!/usr/bin/env bash
# https://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-hdf5-with-intel-compilers
## PREREQS
# 1) szip 2.1
export CC=icc
export CXX=icpc
export FC=ifort
export CFLAGS='-O3 -xHost -ip'
export CXXFLAGS='-O3 -xHost -ip'