Skip to content

Instantly share code, notes, and snippets.

View grawity's full-sized avatar

Mantas Mikulėnas grawity

View GitHub Profile
@grawity
grawity / update.py
Created November 8, 2021 07:11
Copy of n.dns.update for github
import dns.rdtypes.ANY.TKEY
import dns.resolver
import dns.update
import gssapi
import socket
import time
import uuid
def _build_tkey_query(token, key_ring, key_name):
inception_time = int(time.time())
<?xml version="1.0"?>
<!-- /etc/dbus-1/system.d/hidepid.conf -->
<!-- This prevents users from bypassing /proc hidepid= restrictions using 'systemctl status'. -->
<busconfig>
<!-- Allow root to use systemctl -->
<policy user="root">
<allow send_destination="org.freedesktop.systemd1"
send_interface="org.freedesktop.systemd1.Manager"
send_member="GetUnitProcesses"/>
</policy>
#if 0
src = $(MAKEFILE_LIST)
app = $(basename $(src))
$(app): LDLIBS = -lX11 -lXi
$(app): $(src)
define source
#endif
#define _GNU_SOURCE
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int get_prop_card32(Display *d, Window w, Atom p) {
Atom actual_type;
@grawity
grawity / knob.c
Last active May 17, 2018 13:13
PulseAudio 'System Events' volume knob
#if 0
pkg = libpulse
src = $(MAKEFILE_LIST)
app = $(basename $(src))
CFLAGS = $(shell pkg-config --cflags $(pkg)) -x c
LDFLAGS = $(shell pkg-config --libs $(pkg))
$(app): $(src)
#!/usr/bin/env perl
use warnings;
use strict;
use Net::DBus;
use Net::DBus::Reactor;
use POSIX;
my $inhibit_fd;
my $logind_mgr;
#if 0
pkg = glib-2.0 gio-2.0
src = $(MAKEFILE_LIST)
app = $(basename $(src))
CFLAGS = $(shell pkg-config --cflags $(pkg)) -x c
LDFLAGS = $(shell pkg-config --libs $(pkg))
$(app): $(src)
@grawity
grawity / WinlogonUnlocker.cpp
Created February 23, 2012 12:07
Workstation unlocker
#include "stdafx.h"
#define WM_LOGONNOTIFY 0x004c
#define LN_UNLOCK_WORKSTATION 0x0006
void showError()
{
LPTSTR pBuf;
DWORD nBytes = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, GetLastError(), LANG_USER_DEFAULT, (LPWSTR)&pBuf, 4096, NULL);