Skip to content

Instantly share code, notes, and snippets.


Ryan A. Pavlik rpavlik

View GitHub Profile
rpavlik / fonts.ps1
Last active May 18, 2022
basic system setup
View fonts.ps1
$FontRelease = "2111.01"
$FontArchive = "CascadiaCode-${FontRelease}.zip"
wget.exe "$FontRelease/$FontArchive"
# -aoa = always overwrite
7z x -oCascadiaCode -aoa "${FontArchive}"
$fonts = (New-Object -ComObject Shell.Application).Namespace(0x14)
rpavlik /
Last active Aug 1, 2021
air quality on funhouse/clue
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) 2021 Melissa LeBlanc-Williams for Adafruit Industries
# SPDX-FileCopyrightText: 2021, Ryan Pavlik <>
# SPDX-License-Identifier: MIT
from typing import Optional
except ImportError:
# SPDX-FileCopyrightText: 2020-2021, Ryan Pavlik
# SPDX-License-Identifier: CC0-1.0
# Nothing sh-specific here, these work fine in pwsh as well
# Mostly about remote handling
git config --global alias.rup "remote update --prune"
git config --global "push --force-with-lease"
git config --global pull.ff only
git config --global commit.verbose true
View settings.json
"$schema": "",
"copyOnSelect": false,
"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
// Add custom keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about keybindings, visit
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
fpletz /
Last active Dec 21, 2021
aioesphomeapi minimal examples
#!/usr/bin/env python3
import aioesphomeapi
import asyncio
async def main():
loop = asyncio.get_running_loop()
cli = aioesphomeapi.APIClient(loop, "foobarhostname", 6053, "foobarpassword")
await cli.connect(login=True)
rpavlik /
Last active Jul 31, 2019
Spec and registry diffs between OpenXR 0.90 and 1.0

These are not exactly the released versions: I pre-processed them slightly to reduce diff noise, then ran the spec sources through to produce a single adoc file for each spec version. I then used git diff --patience on the combined adoc file and the XML registry.

As an obligatory note, these diffs aren't an official product of the working group, and they are not normative.

As diffs of the spec components, they carry the same license as those spec components.

tclementdev /
Last active Jun 26, 2022
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).

My take-aways are:

  • You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.

  • Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse

xoseperez /
Last active Jun 7, 2022
Raspberry Pi 3 with Mosquitto, Node-RED, InfluxDB, Grafana and Nginx (as a reverse proxy)

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](

d235j / makerbot_rep2x_1st.def.json
Created Nov 26, 2017
Replicator 2X Cura definition
View makerbot_rep2x_1st.def.json
"id": "makerbot_rep2x_1st",
"version": 2,
"name": "1st Extruder",
"inherits": "fdmextruder",
"metadata": {
"machine": "makerbot_replicator_2x",
"position": "0"