Skip to content

Instantly share code, notes, and snippets.

@IntrovertedMage
IntrovertedMage / 2-change-status-bar-color.lua
Last active September 26, 2025 17:37
KOReader custom status bar color user patch, implements color persitance when changing style fix by @sebdelsol https://gist.github.com/sebdelsol/eba2e492473ac1f9e0ecb003d403b7de
local readerFooter = require("apps/reader/modules/readerfooter")
local ProgressWidget = require("ui/widget/progresswidget")
local BD = require("ui/bidi")
local Blitbuffer = require("ffi/blitbuffer")
local Geom = require("ui/geometry")
local Math = require("optmath")
local Screen = require("device").screen
-- Somewhat empirically chosen threshold to switch between the two designs ;o)
local INITIAL_MARKER_HEIGHT_THRESHOLD = Screen:scaleBySize(12)
@sebdelsol
sebdelsol / 2-filemanager-title-bar.lua
Last active June 24, 2025 12:44
KOReader userpatch to show info in the file browser title with autorefresh_time
-- **MOVED to https://github.com/sebdelsol/KOReader.patches**
-- KOReader userpatch to show info in the file manager title bar
-- based on https://gist.github.com/hius07/c53bc1ed00e0490cb1a0709c5ed6e735#file-2-fm-title-info-lua
-- Menu added in the File browser menu (1st icon) to change all the settings and rearrange the items in the title bar
-- Items added: Custom text, Brightness Level, Warmth Level, Up time, Time spent awake, Time in suspend
-- Settings added: Auto refresh clock, Custom separator, Number of spaces around separator, Show wifi when disabled, Show frontlight when off, Show path
-- Fix screen rotation (path was disappearing)
-- Arrange items reorders the items the menu
@sebdelsol
sebdelsol / 2-screensaver-cover.lua
Last active May 26, 2025 15:28
KOReader user patch: Screensaver message do not overlap the cover & clear all widgets when the screensaver has no background
-- **MOVED to https://github.com/sebdelsol/KOReader.patches**
-- Add 4 new options @ the end of the "Sleep screen" menu :
-- Close widgets before showing the screensaver
-- Refresh before showing the screensaver
-- Message do not overlap image
-- Center image
-- By default it doesn't change the sleep screen behavior
@IntrovertedMage
IntrovertedMage / 2-custom_title.lua
Last active October 7, 2025 17:26
A KOReader user patch to change the text in the title above the filemanager page
local FileManager = require("apps/filemanager/filemanager")
-- Type what you want to replace the 'KOReader' title above your filemanger in the quotes on the next line
local title = "ENTER CUSTOM TITLE HERE (ORIGINALLY 'KOReader')"
-- Example: local title = "Library"
FileManager.title = title
@lfhbento
lfhbento / userscript.js
Last active September 19, 2025 10:25 — forked from spf13/script.js
Download all your Kindle books before Feb 26, 2025
// ==UserScript==
// @name Kindle Download
// @namespace http://tampermonkey.net/
// @version 2025-02-20
// @description Download all your kindle books
// @author You
// @match https://www.amazon.com/hz/mycd/digital-console/contentlist/booksPurchases/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=amazon.com
// @grant none
// ==/UserScript==
@IntrovertedMage
IntrovertedMage / 2-preferred-dictionaries-menu.lua
Last active March 5, 2025 02:11
A KOReader user patch that adds a menu to make it more easy to set the preferred dictionaries for the book you're currently reading
local Menu = require("ui/widget/menu")
local ReaderDictionary = require("apps/reader/modules/readerdictionary")
local Event = require("ui/event")
local UIManager = require("ui/uimanager")
local util = require("util")
local _ = require("gettext")
local addToMainMenu_orig = ReaderDictionary.addToMainMenu
ReaderDictionary.addToMainMenu = function(self,menu_items)
@JediRhymeTrix
JediRhymeTrix / asin_fixer.py
Last active December 30, 2024 23:19
Calibre Kindle ASIN Fixer: Extracts ASINs from Calibre metadata, scrapes Amazon for Kindle variants, and updates .opf files (and calibre.db) to ensure Kindle Colorsoft loads book covers properly.
# ASIN Fixer for Kindle Colorsoft Cover Issues
#
# Since the new Kindle Colorsoft only loads book covers from Amazon servers, having the correct Kindle ASIN is crucial for covers to display properly.
# Calibre doesn’t always fetch the correct Kindle ASIN, which is the only way for the Kindle to download the cover.
# This tool extracts ASINs from Calibre `.opf` files, scrapes Amazon for Kindle variants, and updates the `.opf` files with the correct Kindle ASIN.
# Additionally, it reads from the Calibre database, updates book identifiers in the database based on the `.opf` files.
#
# How It Works:
# 1. Extract ASINs: Pulls existing ASINs from `.opf` files in your Calibre library.
# 2. Scrape Amazon: Uses Selenium to visit Amazon and scrape the correct Kindle ASIN.
@dmalinovsky
dmalinovsky / 2-logical-page-count.lua
Created April 2, 2024 23:02
Patch for KOReader to build logical page count
local ReaderPageMap = require("apps/reader/modules/readerpagemap")
local postInit_orig = ReaderPageMap._postInit
ReaderPageMap._postInit = function(self)
self.ui.document:buildSyntheticPageMapIfNoneDocumentProvided(1818)
-- Run original code
postInit_orig(self)
end
@ndaversa
ndaversa / plex.py
Last active August 15, 2021 23:46
Python script that will ping a local Plex Media Server to determine if its responding as expected (if not it will kill it and restart it) Bandaid solution used to cure occasional PMS hang ups. This script should be scheduled to run on an interval (eg. every 5 mins) see: https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSy…
#!/usr/bin/env python
from os import system
import sys
import urllib2
import time
import datetime
#from prowlpy import Prowl
def status():
try: