Skip to content

Instantly share code, notes, and snippets.

@messmerd
messmerd / BluetoothStart.sh
Last active June 8, 2020 03:02
This shell script turns on Bluetooth and connects to a Bluetooth device.
#!/bin/bash
# This script can run at startup or whenever you wish to connect to your Bluetooth device.
# You can use cron to run this script at startup. To do this, run 'crontab -e' and select
# your preferred editor if you haven't already. Then add this to the end of the file:
# @reboot /path/to/BluetoothStart.sh &
# Also, make sure this script has execution permissions: 'chmod +x ./BluetoothStart.sh'
# Make sure pulseaudio is running
@messmerd
messmerd / BranchlessExample.cpp
Last active January 1, 2025 22:16
Easy branchless programming in modern C++ by turning every if into if constexpr
/*
* BranchlessExample.cpp
* Written by Dalton Messmer <messmer.dalton@gmail.com>
*
* Requires C++17 or higher
*
* This example essentially allows the usage of non-constexpr integers as template parameters
* of a function template. It does this by instantiating template functions over a desired
* range of template parameter values. Function pointers to these function template instantiations
* are stored in an array with the template parameter values mapped to the array indexes. A

Last updated: 1/16/2025.

Notes

  • Some items from late 2023 and prior may be missing or link to the PR rather than the issue that was resolved
  • For each category, I tried to keep chronological order from oldest PRs merged to newest
  • There may be some miscategorizations
  • To transform an issue/PR reference like "#1234" into the link, I used this regex:
    • Find: \#([0-9]\w+)
    • Replace: \[\#\1\]\(https://github.com/LMMS/lmms/issues/\1\)
@messmerd
messmerd / output.txt
Last active May 30, 2025 21:26
wineg++ std::wstring misbehavior
Testing wineg++ in C++17 mode...
0088:err:ole:start_rpcss Failed to start RpcSs service
wstr.length() = 5
std::wcslen(wstr.c_str()) = 4
wstr.end() - wstr.begin() = 10
cs =
str = 0031, 0032, 0033
wcs = 0031, 0032, 0033
wstr = 0031, 0032, 0033, 0000, f000, 2040, 7f23, 0000, 0000, 0000