Skip to content

Instantly share code, notes, and snippets.

View depau's full-sized avatar

Davide Depau depau

View GitHub Profile
@depau
depau / 1-README.md
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
depau / normalizer.sh
Created November 27, 2023 12:15
JavaCard SDK normalizer script for Linux and Unix-like systems
#!/bin/bash
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
depau / README.md
Last active November 20, 2023 19:28
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.

@depau
depau / android-qemu.sh
Created August 23, 2019 02:30
Run Android-x68 on QEMU with emulated USB stick
#!/bin/bash
# By Chih-Wei Huang <cwhuang@linux.org.tw>
# License: GNU Generic Public License v2
continue_or_stop()
{
echo "Please Enter to continue or Ctrl-C to stop."
read
}
@depau
depau / README.md
Last active August 31, 2023 15:50
Hoppscotch Valetudo API v2 requests

Hoppscotch collection for Valetudo

https://hoppscotch.io

To import

  • Open Collections tab
  • Click Import/Export
  • Click the 3-dot menu and select Import from Gist
  • Paste this Gist URL
@depau
depau / 0-README.md
Last active July 27, 2023 16:16
Python initialization adventures

Recommended viewing experience

if(GlobalVariable* GA = M.getGlobalVariable("llvm.global.annotations")) {
// 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
depau / 1-README.md
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.

@depau
depau / kelon_decoder.py
Last active January 18, 2022 17:41
Kelon AC IR command decoder
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
MODES = {
0: "heat",
1: "smart",
2: "cool",
3: "dehum",
" 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")