Skip to content

Instantly share code, notes, and snippets.

@LegalizeAdulthood
LegalizeAdulthood / ReadMe.md
Last active April 2, 2025 21:48
Simple vcpkg overlay setup

Simple vcpkg Overlay Ports Setup

The file vcpkg-configuration.json uses an existing vcpkg as the default registry; this assumes vcpkg as a git submodule. The baseline value is the commit hash of the vcpkg submodule. Update the hash as needed to reflect the actual version of the vcpkg registry you've got checked out as a submodule.

Overlay Ports

Use a directory vcpkg-overlays to contain the overlay ports;

@LegalizeAdulthood
LegalizeAdulthood / asm-dump.md
Created January 7, 2025 16:51
Disassemble an Object File with MSVC Linker
@LegalizeAdulthood
LegalizeAdulthood / CMakePresets.json
Last active March 13, 2024 07:47
clang CMake Presets
{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 23,
"patch": 0
},
"configurePresets": [
{
"name": "sibling-build-preset",
@LegalizeAdulthood
LegalizeAdulthood / latest-cmake.sh
Last active February 21, 2024 15:49
Install latest CMake on ubuntu
# run this script with sudo
# From <https://askubuntu.com/questions/355565/how-do-i-install-the-latest-version-of-cmake-from-the-command-line>
apt remove --purge --auto-remove cmake
apt update
apt install -y software-properties-common lsb-release && \
apt clean all
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main"
apt update
apt install kitware-archive-keyring
@LegalizeAdulthood
LegalizeAdulthood / PortingFromMFCToWxWidgets.md
Last active January 26, 2025 12:41
Porting from MFC to wxWidgets
@LegalizeAdulthood
LegalizeAdulthood / SpaceshipOperator.txt
Last active January 4, 2022 03:04
A counterintuitive breaking change related to new comparisons C++17 vs. C++20
comp.lang.c++ #1074341 (1)
From: Andrey Tarasevich <[email protected]>
[1] A counterintuitive breaking change related to new comparisons
Date: Mon Jan 03 10:48:42 MST 2022
Lines: 42
A colleague discovered that switching from `-stc=c++17` to `-std=c++20`
in their project resulted in a different behavior from some associative
containers. A bit of research allowed to narrow down the culprit to what
can be demonstrated by the following minimalist example
@LegalizeAdulthood
LegalizeAdulthood / HowToSonarQube.md
Created May 8, 2019 21:55
SonarQube Configuration for C++ Projects

SonarQube Configuration for C++ Projects

  1. Download SonarQube from SonarQube.org.
  2. Unpack the distribution.
  3. Download the C++ community plugin.
  4. Install the plugin using these instructions.
  5. Run bin\windows-x86-64\StartSonar.bat to start the server.
  6. Wait for the server to output the message SonarQube is up.
  7. Browse to http://localhost:9000 and login with admin/admin.
  8. Create a project by following the built-in tutorial.
  9. Configure the scanner for C++
@LegalizeAdulthood
LegalizeAdulthood / Outline.md
Last active February 7, 2018 22:41
Give Your Old Code Some New Love

Case Study

  • Our case study is the open source fractal generator Iterated Dynamics, a fork of FRACTINT.
  • This is a 30 year old code base that started as a 16-bit MS-DOS program written in C and 16-bit x86 assembly.
  • The code base has contributions from many, many authors over the years.
  • Source formatting and identifier conventions are varied due to the large number of authors.
  • Source code organization has been tortured by the constraints of early MS-DOS programs operating in a limited amount of physical memory and the use of overlays.
  • Conditional compilation was sprinkled throughout to enable various debugging facilities or experiments in alternative implementations.
  • As C does not have inline functions, there are some places that heavily use preprocessor macros.
  • Some of the functions are [exceedingly long*](https://github.com/LegalizeAdulthood
@LegalizeAdulthood
LegalizeAdulthood / Outline.md
Last active December 14, 2017 18:54
Embedded Development with Kvasir

Refresher of Embedded Development

  • Characteristics of an embedded environment
    • Bare metal interaction with hardware
    • No operating system
    • No virtual memory
    • No C/C++ runtime
  • No RTTI
@LegalizeAdulthood
LegalizeAdulthood / json.cpp
Created November 15, 2017 22:49
Compile-time JSON example
constexpr auto jsv = R"({
"feature-x-enabled": true,
"value-of-y": 1729,
"z-options": {
"a": null,
"b": "220 and 284",
"c": [ 6, 28, 496 ]
}
})"_json;