Skip to content

Instantly share code, notes, and snippets.

@Dregu
Dregu / moonlight-gpio.py
Last active October 25, 2024 14:32
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
import dbus
from gpiozero import Button
from signal import pause
sysbus = dbus.SystemBus()
systemd1 = sysbus.get_object('org.freedesktop.systemd1', '/org/freedesktop/systemd1')
manager = dbus.Interface(systemd1, 'org.freedesktop.systemd1.Manager')
@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);
@Dregu
Dregu / reddit_auto_expand.user.js
Last active December 10, 2021 15:51
Reddit Auto Expand
// ==UserScript==
// @name Reddit Auto Expand and keyboard navigation
// @namespace http://www.reddit.com/
// @version 0.1
// @description Auto expand all expandos on new reddit and a keyboard navigation that's not retarded.
// @author Dregu
// @match https://www.reddit.com/*
// @grant none
// ==/UserScript==
@Dregu
Dregu / fuck-twitch.user.js
Last active June 15, 2023 02:32
Userscript to hide stupid fucking streamers or games from Twitch
// ==UserScript==
// @name Fuck Twitch
// @namespace FuckTwitch
// @description Hide stupid fucking streamers or games from Twitch
// @version 1.0
// @author Dregu
// @match https://*.twitch.tv/*
// @run-at document-start
// ==/UserScript==
@Dregu
Dregu / warmup.png
Last active March 25, 2018 19:52
Warmup screenshot
Attached