This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# git pre-push script to mirror pushed files to another directory | |
destdir=/mirror-dir | |
if [ `git branch --show-current` != "main" ]; then | |
echo "pre-push: Not on main branch - skipping" | |
else | |
echo "pre-push: Mirroring to $destdir" | |
(git diff @{push} @ --diff-filter=ACMR --name-only | while read file; do | |
echo "pre-push: Copying $file" | |
install -D "$file" "$destdir/$file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <string> | |
#include <string_view> | |
#include <charconv> | |
#include <vector> | |
#include <span> | |
#include <ranges> | |
#include <concepts> | |
#include <type_traits> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ShowDecl: Pretty-print an expression's decltype. | |
// Works with popular C++20 compilers. | |
// by Len Popp | |
// ref: Arthur O'Dwyer https://quuxplusone.github.io/blog/2018/08/22/puts-pretty-function/ | |
#include <string> | |
#include <string_view> | |
#include <utility> | |
#include <iostream> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Insert this in your CMakeLists.txt file, after add_executable(): | |
# Update version info file from the latest git tag | |
set(VERSION_FILE "version.h") # CHANGE to whatever you want | |
target_sources(MyExecutableName PRIVATE ${VERSION_FILE}) # CHANGE MyExecutableName | |
set(CMD_PYTHON "py") # for Windows - CHANGE if necessary | |
#set(CMD_PYTHON "/usr/local/bin/python3.11") # for macOS, Linux | |
set(VERSION_TEMP_FILE "${PROJECT_BINARY_DIR}/version-temp") | |
set(VERSION_INFO_FILE "${PROJECT_BINARY_DIR}/version-info") | |
add_custom_target(MakeVersionFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CritSec - Critical section helper class for Raspberry Pi Pico SDK | |
// by Len Popp | |
// | |
// Usage | |
// | |
// #include "CritSec.h" | |
// | |
// { | |
// CritSec<AnyType>::init(); | |
// /* ... */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DataTable - Compile-time calculation of data lookup tables | |
// by Len Popp | |
// Ref: | |
// https://github.com/AshleyRoll/cppcon21/blob/main/code/table_gen_1.cpp - Ashley Roll | |
// https://tinyurl.com/constexpr2021 - Jason Turner | |
#include <array> | |
#include <algorithm> | |
#include <ranges> |