Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import sys, gi, signal, pyinotify
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GObject, GLib
# init GObject & Co. before importing local classes
GObject.threads_init()
Gst.init([])
@studiofuga
studiofuga / bluezutils.py
Last active March 25, 2021 07:24
Bluetooth agent that performs pairing with a fixed pin ("0000").
import dbus
SERVICE_NAME = "org.bluez"
ADAPTER_INTERFACE = SERVICE_NAME + ".Adapter1"
DEVICE_INTERFACE = SERVICE_NAME + ".Device1"
def get_managed_objects():
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object("org.bluez", "/"),
"org.freedesktop.DBus.ObjectManager")
@schoentoon
schoentoon / inotify.c
Last active February 27, 2024 22:13
Simple example of how to use inotify with libevent. Compile with gcc -o inotify inotify.c -levent
#include <stdio.h>
#include <event.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <sys/inotify.h>
static void displayInotifyEvent(struct inotify_event *i)
{
printf(" wd =%2d; ", i->wd);