Skip to content

Instantly share code, notes, and snippets.

/*
* This file is generated by gdbus-codegen, do not modify it.
*
* The license of this code is the same as for the D-Bus interface description
* it was derived from. Note that it links to GLib, so must comply with the
* LGPL linking clauses.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
@swick
swick / portal-test.py
Created October 15, 2025 15:20
global shortcuts activation token test
#!/bin/env python3
import dbus
import dbus.mainloop.glib
from dbus.mainloop.glib import DBusGMainLoop
from typing import Any, Dict, Optional, NamedTuple, Callable, List
from gi.repository import GLib
import logging
from itertools import count
@swick
swick / cdefer.c
Created January 18, 2025 00:03
horrible C defer
/* Requires specific nested function extension */
#define G_INLINE_DEFER __DEFER(__COUNTER__)
#define __DEFER(N) __DEFER_(N)
#define __DEFER_(N) __DEFER__(__DEFER_FUNCTION_ ## N, __DEFER_VARIABLE_ ## N)
#define __DEFER__(F, V) \
auto void F(int*); \
__attribute__((cleanup(F))) int V; \
auto void F(int*)
/* Requires __VA_OPT__ from GNU C */
@swick
swick / silverblue-devel-utils
Last active May 13, 2024 21:25
silverblue-devel-utils
#!/bin/sh
set -euo pipefail
#set -x
MICRODNF_PACKAGES_F38="https://kojipkgs.fedoraproject.org//packages/microdnf/3.9.0/2.fc38/x86_64/microdnf-3.9.0-2.fc38.x86_64.rpm \
https://kojipkgs.fedoraproject.org//packages/libpeas/1.34.0/3.fc38/x86_64/libpeas-1.34.0-3.fc38.x86_64.rpm \
https://kojipkgs.fedoraproject.org//packages/dnf/4.14.0/2.fc38/noarch/dnf-data-4.14.0-2.fc38.noarch.rpm \
https://kojipkgs.fedoraproject.org//packages/libdnf/0.68.0/2.fc38/x86_64/libdnf-0.68.0-2.fc38.x86_64.rpm"