Skip to content

Instantly share code, notes, and snippets.

View BuzzwordChief's full-sized avatar
Delivering Value to The People

David May BuzzwordChief

Delivering Value to The People
View GitHub Profile
@BuzzwordChief
BuzzwordChief / avahi-alias@.service
Last active January 13, 2026 07:19
avahi-alias@.service
# Usage systemctl enable --now avahi-alias@myalias.local.service
[Unit]
Description=Publish %I as alias for %H.local via mdns
[Service]
Type=simple
ExecStart=/bin/bash -c "avahi-publish -a -R %I $(hostname -I | awk '{print $1}')"
Restart=on-failure
RestartSec=5s
@BuzzwordChief
BuzzwordChief / probe-rs-itm-print.py
Created January 11, 2026 01:22
Helper to output probe-rs ITM swo output directly to the terminal
#!/usr/bin/env python3
#
# Helper to output probe-rs ITM swo output directly to the terminal
#
# Example: probe-rs itm --chip STM32G474RE swo 100 16000000 16000000 | ./probe-rs-itm-print.py
#
itm_port = 0
@BuzzwordChief
BuzzwordChief / EXAMPLE-CMakeLists.txt
Created May 12, 2024 03:15
CMake-Git-Version-Embedder
# ...
set(VERSION_H_IN_PATH ${CMAKE_CURRENT_LIST_DIR}/src/version.h.in)
set(VERSION_H_PATH ${CMAKE_CURRENT_LIST_DIR}/src/version.h)
add_custom_target(
GenerateVersionH ALL
COMMAND ${CMAKE_COMMAND} -D IN_FILE=${VERSION_H_IN_PATH} -D OUT_FILE=${VERSION_H_PATH} -P ${CMAKE_CURRENT_LIST_DIR}/GitVersionEmbedder.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
)

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

@BuzzwordChief
BuzzwordChief / build.sh
Last active September 9, 2021 16:41
Generic C(++) build script
#! /bin/sh
# @Author: David May
# @Date: 06.09.2021
# @Last Modified by: David May
# @Last Modified time: 09.09.2021
# Config
COMPILER_CMD="clang"
BUILD_PATH="./build"
SRC_PATH="./src"
@BuzzwordChief
BuzzwordChief / pre-commit-git
Last active May 27, 2024 05:05
Git nocheckin pre commit hook
#!/bin/sh
# License: use it i don't care
# reject commit if nocheckin was detected
locations_of_no_checkin=$(git diff -i --diff-filter=d --name-only --cached -G nocheckin)
if [ "$locations_of_no_checkin" = "" ] ; then
exit 0
else
echo "--- Found 'nocheckin' in following files: ---"
@BuzzwordChief
BuzzwordChief / git-init.sh
Created July 15, 2021 01:13
Script to init a new git repo on a serving server
#! /bin/sh
# License: use it i don't care
GIT_BASE=/home/git
REPO_PATH=$GIT_BASE/repos/$1.git
# check if repo name was provided
if [ "$1" = "" ] ; then
exit 1
fi
@BuzzwordChief
BuzzwordChief / svnadmin-create.sh
Last active July 9, 2021 00:00
Create svn repo with pre-commit hook
#! /bin/sh
# License: use it i don't care
# check if repo name was provided
if [ "$1" = "" ] ; then
exit 1
fi
REPO_PATH=/home/svn/repos/$1
SVN_BASE=/home/svn
@BuzzwordChief
BuzzwordChief / svnserve-start.sh
Last active July 8, 2021 14:57
Start a svnserve instance
#! /bin/sh
# License: use it i don't care
SVN_BASE=/home/svn
svnserve --daemon \
--root="$SVN_BASE/repos" \
--config-file="$SVN_BASE/svnserve.conf"
@BuzzwordChief
BuzzwordChief / pre-commit-svn
Last active July 27, 2022 20:19
SVN nocheckin pre commit hook
#!/bin/sh
# License: use it i don't care
REPOS="$1"
TXN="$2"
SVNLOOK=/usr/bin/svnlook
# Make sure that the log message contains some text.
$SVNLOOK log -t "$TXN" "$REPOS" | \
grep "[a-zA-Z0-9]" > /dev/null || exit 1