Skip to content

Instantly share code, notes, and snippets.

View depau's full-sized avatar

Davide Depau depau

View GitHub Profile
depau /
Created May 21, 2024 09:30
Fix WSLg graphics servers on WSL2

Fix WSLg on WSL2

This script fixes non-working Wayland and X11 servers on WSL2 distributions that are not distributed by Microsoft and which may not always work.

It works by linking the server sockets to those created by the WSLg system container, mounted in /mnt/wslg and accessible via wsl -d DISTRO_NAME --system.

depau /
Last active May 16, 2024 19:16
Download scontrini Esselunga - userscript

Download scontrini Esselunga in massa

Questo userscript aggiunge un bottone per scaricare tutti gli scontrini disponibili nell'area personale di Esselunga.

Lo script si ricorda dei download già effettuati, e li ignora le volte successive.

Funziona solo su browser Chrome-based perché il sito di Esselunga è stato sviluppato poggiando la tastiera sulla sedia e digitando con una penna infilata nell'apertura posteriore.


depau /
Last active March 2, 2024 05:33
VitalSource web book page scraper

VitalSource web book page scraper

This pair of userscripts (to be used with any usescript manager such as ViolentMonkey) allow scraping books from the VitalSource Bookshelf web reader.

This allows creating a PDF for offline reading with free-software readers such as Calibre.

The "inner" script hooks into the book page nested iframe; it detects when a new page image is loaded and it automatically starts a browser download.

The "outer" script hooks into the main reader page and adds a "Scrape" button which automatically goes to the next page when the inner script has successfully downloaded a page.

depau /
Created November 27, 2023 12:15
JavaCard SDK normalizer script for Linux and Unix-like systems
set -euo pipefail
# Place this script next to `normalizer.bat`
# Set JC_CLASSIC_HOME to the parent directory of the script location
JC_CLASSIC_HOME=$(dirname "$(readlink -f "$0")")/..
# Print warning if no JAVA_HOME set
if [ -z "$JAVA_HOME" ]; then
depau /
Last active July 27, 2023 16:16
Python initialization adventures

Recommended viewing experience

if(GlobalVariable* GA = M.getGlobalVariable("")) {
// the first operand holds the metadata
for (Value *AOp : GA->operands()) {
// all metadata are stored in an array of struct of metadata
if (ConstantArray *CA = dyn_cast<ConstantArray>(AOp)) {
// so iterate over the operands
for (Value *CAOp : CA->operands()) {
// get the struct, which holds a pointer to the annotated function
// as first field, and the annotation as second field
if (ConstantStruct *CS = dyn_cast<ConstantStruct>(CAOp)) {
depau /
Last active March 6, 2023 06:40
Force sound mode on LG C1 OLED webOS TV

Force sound mode on LG C1 OLED webOS TVs

This script works around the annoying feature of LG webOS TVs which automatically change the sound mode to "Game optimizer" when Game optimizer is selected as the video mode.

It works around it by setting it back to a user-selected mode every 5 seconds in case it changed to something else.

To install it your TV needs to be rooted. See RootMyTV and WebOSBrew.

" Vim syntax file
" Language: MVS jcl (jcl)
" Maintainer: Fiorenzo Zanotti
" Last Change: 2002 Sep 22
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
depau /
Last active January 18, 2022 17:41
Kelon AC IR command decoder
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
0: "heat",
1: "smart",
2: "cool",
3: "dehum",
depau /
Last active June 9, 2024 11:06
Valetudo Gamepad Control

PyGame-based Valetudo Gamepad Remote Control

Uses PyGame, so it should work with all gamepads that work in actual games.

Nasty code ;)

It requires the gamepad to have at least one analog stick.

Modify the script and set DRY_RUN to True to avoid contacting Valetudo during gamepad testing.