Skip to content

Instantly share code, notes, and snippets.

View kode54's full-sized avatar

Christopher Snowhill kode54

View GitHub Profile
From patchwork Mon Apr 1 18:58:06 2024
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
X-Patchwork-Id: 13612954
Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com
[209.85.128.179])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
@kode54
kode54 / bing_wallpaper.sh
Created February 16, 2024 22:02
Bing wallpaper grabber for SwayBG or for Wayfire shell
#!/bin/sh
# systemd example: https://stackoverflow.com/a/50321912
# cron example:
# 0 * * * * ~/.config/sway/scripts/bing_wallpaper.sh
# exit on error
set -e
if [ -z "$WAYLAND_DISPLAY" ]; then
@kode54
kode54 / mesa-vulkan-debuginfo.patch
Created October 7, 2023 00:12
Mesa Vulkan always emit debug info patch (May be vaguely useful sometimes)
diff --git a/src/vulkan/runtime/vk_log.c b/src/vulkan/runtime/vk_log.c
index dfd4a2e5172..0335c1446e2 100644
--- a/src/vulkan/runtime/vk_log.c
+++ b/src/vulkan/runtime/vk_log.c
@@ -111,7 +111,7 @@ __vk_log_impl(VkDebugUtilsMessageSeverityFlagBitsEXT severity,
}
}
-#ifndef DEBUG
+#if 0
@kode54
kode54 / error.txt
Created July 10, 2023 07:26
Tenacity Git build error
/home/chris/.cache/paru/clone/tenacity-git/src/tenacity/libraries/lib-audio-devices/AudioIOBase.cpp:709:6: error: use of overloaded operator '<<' is ambiguous (with operand types 'std::ostringstream' (aka 'basic_ostringstream<char>') and 'const char[33]')
s << "EXPERIMENTAL_MIDI_OUT is enabled" << std::endl;
~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/chris/.cache/paru/clone/tenacity-git/src/tenacity/libraries/lib-strings/TranslatableString.h:320:14: note: candidate function [with Sink = std::basic_ostringstream<char>]
inline Sink &operator <<( Sink &sink, const TranslatableString &str )
^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../include/c++/13.1.1/ostream:662:5: note: candidate function [with _Traits = std::char_traits<char>]
operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../include/c++/13.1.1/ostream:645:5: note: candidate function [with _CharT = char, _Traits = std::char_traits<cha
@kode54
kode54 / limit.cpp
Created May 13, 2023 08:53
Audio Soft Limiter
#include <math.h>
#include <float.h>
static inline float f_max(float v1,float v2)
{
return v1>v2 ? v1 : v2;
}
static const float limiter_max = (float)0.9999;
@kode54
kode54 / 0000-README.md
Last active May 30, 2023 15:56
Xe KMD uAPI adjustments

These are minimal adjustments to the current uAPI, as inspired by Maarten Lankhorst and his process of running the headers through pahole. But instead, I adjusted them manually, making minimal changes so that the 64-bit uarch would result in the same alignment, so existing userspace software with the previous header will still work. The only difference is that 32-bit userspace software needs the new header, to continue working with the kernel.

I've split it into two patches, like was suggested to @mlankhorst, one with the uAPI header, and one with the validation code.

Edited 2023-05-12 20:42 PDT: Updated against latest rebase.

@kode54
kode54 / 43.4.patch
Created April 19, 2023 16:03
Mutter VRR patch, rebased against mutter 43.4
From 596f396f62ab834845fe1253ebb677866f9a6b23 Mon Sep 17 00:00:00 2001
From: Dor Askayo <dor.askayo@gmail.com>
Date: Sun, 16 Aug 2020 17:14:03 +0300
Subject: [PATCH 02/25] surface-actor: Add "frozen" signal
This signal is emitted when the surface actor is frozen and will not
update until it is thawed.
---
src/compositor/meta-surface-actor.c | 11 +++++++++++
1 file changed, 11 insertions(+)
@kode54
kode54 / vmbind.patch
Created April 19, 2023 09:38
PATCH v10 of the Intel Graphics VM_BIND set, rebased against drm-tip from 2023-04-19
From mboxrd@z Thu Jan 1 00:00:00 1970
Return-Path: <dri-devel-bounces@lists.freedesktop.org>
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.lore.kernel.org (Postfix) with ESMTPS id 1175EC32793
for <dri-devel@archiver.kernel.org>; Wed, 18 Jan 2023 07:16:20 +0000 (UTC)
Received: from gabe.freedesktop.org (localhost [127.0.0.1])
@kode54
kode54 / obs-recording-toggle.py
Created March 18, 2023 00:19
OBS Recording Toggle, based on obs-wayland-shortcuts, but using obs-cli and not obs-cli-leafac.
#!/usr/bin/env python3
# Original Author: Andrew Shark
# Homepage: https://gitlab.com/AndrewShark/obs-wayland-shortcuts
# License: GPLv3
# Modified By: Christopher Snowhill
# This script is made for convenience. It is invoked by a logid gesture for MX Master mouse.
@kode54
kode54 / swapinfo.sh
Created October 6, 2022 01:16
Swap Info script for bash, not originally mine
#!/bin/bash
overall=0
outlist=""
for status_file in /proc/[0-9]*/status; do
swap_mem=$(grep VmSwap "$status_file" | awk '{ print $2 }')
if [ "$swap_mem" ] && [ "$swap_mem" -gt 0 ]; then
pid=$(grep Tgid "$status_file" | awk '{ print $2 }')
name=$(grep Name "$status_file" | awk '{ print $2 }')
printf -v output "%s\t%s\t%s KB\n" "$pid" "$name" "$swap_mem"