Skip to content

Instantly share code, notes, and snippets.

View stefanoverna's full-sized avatar

Stefano Verna stefanoverna

View GitHub Profile
@stefanoverna
stefanoverna / bluetooth-reconnect
Created September 27, 2026 11:08
MacBookPro14,1 S3 sleep on Linux: thunderbolt-remove-rescan from omacom/omarchy#11570 with the xHCI count fix, plus a bluetooth-reconnect hook for LE devices
#!/bin/bash
# Reconnect paired + trusted Bluetooth devices after resume.
#
# On the 2016-2017 MacBook Pros the Broadcom UART Bluetooth controller loses
# its LE links in sleep, and LE HID devices (e.g. MX Master 3S) do not come back
# on their own: the kernel drops their reconnect advertisements as "unknown
# advertising packet type", and bluetoothd's own background reconnect never
# completes (a manual connect meanwhile fails with "InProgress"). Connecting
# from the host side, retried, works.
#
@stefanoverna
stefanoverna / hda-fw-state
Created September 27, 2026 11:02
MacBookPro14,1: CS8409 audio after S3 on Linux - systemd-sleep hook that saves/restores the firmware-programmed codec state (subsystem id + pin configs) and re-probes the driver
#!/usr/bin/env python3
"""Save / restore the firmware-programmed state of an HDA codec.
On the 2016-2017 MacBook Pros the firmware programs the CS8409 codec's
subsystem id (0x106b3300 on the 14,1) and the pin default configurations
only at boot. After S3 they read back as vendor id / zeros, so a re-probed
codec is not recognised by snd_hda_macbookpro ("UNKNOWN subsystem id") and
finds no speakers, headphones or mics ("line_outs=0 ... hp_outs=0").
hda-fw-state save FILE [hwC0D0] # from sysfs (kernel cache, valid since boot)

DatoCMS Expert

Professional Standards

You are an expert in DatoCMS. Maintain a professional demeanor and provide accurate, verified responses by consulting the provided files as frequently as necessary.

Understanding User Intent

DatoCMS functions in multiple areas: CMA API, CDA API, and Plugins SDK. When a user's request is unclear, pose clarifying questions to better understand their goals before proceeding.

Default Assumptions for Complex Scenarios

When the user has not provided a definitive schema, approach solutions by considering the most complex scenario possible:

@stefanoverna
stefanoverna / README.md
Created April 30, 2025 12:26
Load testing

Ciao!

{
"id": 0,
"name": "datocms-plugin-sdk",
"variant": "project",
"kind": 1,
"flags": {},
"children": [
{
"id": 1,
"name": "Account",
{
"id": 0,
"name": "datocms-react-ui",
"variant": "project",
"kind": 1,
"flags": {},
"children": [
{
"id": 137,
"name": "FieldGroupProps",
import type { RenderFieldExtensionCtx } from "datocms-plugin-sdk";
import { Canvas } from "datocms-react-ui";
import { useEffect, useState } from "react";
type Props = {
ctx: RenderFieldExtensionCtx;
};
export default function Editor({ ctx }: Props) {
const key = JSON.stringify([ctx.item?.id, ctx.fieldPath]);
{
"id": 0,
"name": "datocms-react-ui",
"variant": "project",
"kind": 1,
"flags": {},
"children": [
{
"id": 135,
"name": "FieldGroupProps",
{
"id": 0,
"name": "datocms-plugin-sdk",
"variant": "project",
"kind": 1,
"flags": {},
"children": [
{
"id": 1,
"name": "Account",
import { buildClient } from "@datocms/cma-client-node";
import fetch from "cross-fetch";
const client = buildClient({
apiToken: process.env.READWRITE_DATOCMS_API_TOKEN,
fetchFn: fetch,
});
async function run() {
for await (const delivery of client.webhookCalls.listPagedIterator({