Skip to content

Instantly share code, notes, and snippets.

@Dregu
Dregu / paper.sh
Last active March 26, 2025 14:10
Set random wallpaper and matching active border gradient using hyprpaper/swaybg and magick
#!/bin/bash
# Set random wallpaper and matching active border gradient using hyprpaper/swaybg and magick
DIR=~/pics/wallpapers
FORCE="$1"
pkill swaybg
paper () {
@Dregu
Dregu / sunset.sh
Last active March 23, 2025 18:30
Control hyprsunset from waybar through IPC socket
#!/bin/bash
CMD=$1
DELTA=$2
TOGGLE=$3
if [ -z "$CMD" ]; then
echo "Set or get gamma and color temperature through hyprsunset IPC socket"
echo "Usage: sunset.sh <gamma/temperature> [+-][value] [toggle]"
exit 1
fi
if [[ ! -z "$TOGGLE" ]]; then
@Dregu
Dregu / README.md
Last active January 28, 2025 15:46
Experiments in running Sunshine on Sway WM headless (virtual display) on demand (WOL request) on nvidia 565 drivers on Arch Linux.

Headless Sway Sunshine stuff

This setup allows you to start a single Sway remote desktop session on a virtual display directly from Moonlight by sending the Wake PC request, waiting a few seconds and connecting to a fresh new desktop. Or you can just have a desktop running constantly in the background. This requires no dummy plugs or input devices attached to the host, but will also allow you to sometimes log in locally and and have that session available on sunshine too. Some of this stuff probably also works with other wlroots-based compositors with small changes.

I'm assuming you've first read and memorized the Sunshine documentation, it probably includes some very important stuff I didn't put here. The stuff about udev rules is probably important, cap_sys_admin not so much.

This is not supposed to be a complete guide to set up headless sunshine streaming and I assume you already know how to

@Dregu
Dregu / moonlight-gpio.py
Last active April 8, 2025 20:55
Scripts to start and stop moonlight or moonlight-embedded systemd service automatically only when the TV is turned on, by connecting the 5V/500mA USB from the TV to Raspberry Pi (3B+) GPIO17 via a 25kΩ/50kΩ voltage divider for a (hopefully) suitable 3.3V signal. Smaller resistors might also work, but this is what I had and it works for me.
#!/usr/bin/env python
# This is for the magical gpio button, ignore if you're not going to solder one
import dbus
from gpiozero import Button
from signal import pause
sysbus = dbus.SystemBus()
systemd1 = sysbus.get_object('org.freedesktop.systemd1', '/org/freedesktop/systemd1')
@Dregu
Dregu / import_weeklies_to_sandbox.py
Created January 23, 2024 05:06
Import all currently subscribed Poly Bridge 3 Weekly Challenge workshop layouts to default profile sandbox
# Import all currently subscribed Poly Bridge 3 Weekly Challenge workshop layouts to default profile sandbox
import urllib.request
import re
import sys
import winreg
import os
import math
import string
import shutil
@Dregu
Dregu / Spelunky2_Character_Tags.lua
Last active February 2, 2023 11:04
Spelunky 2 character animation tags for Aseprite
--[[
How to make full character mods in Aseprite:
1. Save this file (Raw > Save page as...) to Aseprites "File > Scripts > Open Scripts Folder"
2. "File > Import Sprite Sheet" and select a char_..._full sheet or a _grid, use options:
- Type: By Rows
- Width: 128 px
- Height: 128 px
- [x] Include partial tiles (checked)
3. Run the script from "File > Scripts > Spelunky2_Character_Tags"
@Dregu
Dregu / build.bat
Last active October 21, 2022 09:34
Overlunky/Playlunky build scripts
@echo off
:: build.bat [MSVC|Clang|Ninja] [Release|Debug|RelWithDebInfo] [custom options for cmake]
set A=Ninja
set B=Release
set C=-DIWYU=ON -DBUILD_INFO_DUMP=OFF -DBUILD_SPEL2_DLL=OFF
:: set C=-DPLAYLUNKY_CONAN_VERBOSE=ON
if /I [%1] == [MSVC] set A=MSVC
@Dregu
Dregu / README.md
Last active March 14, 2024 14:23
Spelunky 2 custom tile codes

Spelunky 2 custom tile codes

Random custom tile codes and other crap for custom levels. Free for all!

@Dregu
Dregu / Noita.asl
Last active May 29, 2022 18:02
Noita Scriptable Auto Splitter (+seed/kill display) for LiveSplit
/*
* Noita Scriptable Auto Splitter + seed display + kill counter
* Starts on spawn
* Splits on work
* Resets on death or new game
*
* You have to edit the logPath below to point to your installation for this to actually work, I don't know where your game is.
* Get https://github.com/hawkerm/LiveSplit.ASLVarViewer to display world seed and/or kill counter to your stream, mom or whatever.
*/
#!/usr/bin/env node
var gst = require('gstreamer-superficial');
const port = process.env.UDPPORT || 5000
const timeout = process.env.UDPTIMEOUT || 500
var pipeline = new gst.Pipeline('udpsrc name=src port='+port+' timeout='+timeout+'000000 ! application/x-rtp,media=audio,clock-rate=44100,encoding-name=L16,channels=2,payload=96 ! rtpL16depay ! audioconvert ! autoaudiosink');
var src = pipeline.findChild('src');
pipeline.pollBus((msg) => {
if (msg.name == 'GstUDPSrcTimeout') {
console.log(new Date, 'source timeout in port ' + src.port);