Skip to content

Instantly share code, notes, and snippets.

View equwal's full-sized avatar
🎯
Focusing

Spenser Truex equwal

🎯
Focusing
View GitHub Profile
@equwal
equwal / 2-translator-http-override.lua
Created May 3, 2024 08:00
Translation has not been available in China since about one day ago #9574
-- To be used if a DNS lookup for translate.googleapis.com would fail
local Translator = require("ui/translator")
local http = require("socket.http")
Translator.getTransServer = function()
-- Change this with a usable/working IP address (that would work if added to a HOSTS file)
return "https://180.163.151.162/"
end
@equwal
equwal / 2-overlap_arrow_32.lua
Created May 3, 2024 07:59
How can I modify arrow of page overlap function? #9181
local Screen = require("device").screen
local IconWidget = require("ui/widget/iconwidget")
local ReaderView = require("apps/reader/modules/readerview")
local addWidgets_orig = ReaderView.addWidgets
ReaderView.addWidgets = function(self)
-- Run original code
addWidgets_orig(self)
local arrow_size = Screen:scaleBySize(16 * 2)
self.arrow = IconWidget:new{
icon = "control.expand.32",
@equwal
equwal / 2-no-jump-in-flipping-mode.lua
Created May 3, 2024 07:58
Is it possbile to disable touch (navigate) property of the progress bar? #9277
local ReaderFooter = require("apps/reader/modules/readerfooter")
local onTapFooter_orig = ReaderFooter.onTapFooter
ReaderFooter.onTapFooter = function(self, ges)
if self.view.flipping_visible then return true end
return onTapFooter_orig(self, ges)
end
@equwal
equwal / 2-movable-not-movable.lua
Created May 3, 2024 07:57
Disable floating window movement? #9646
local MovableContainer = require("ui/widget/container/movablecontainer")
MovableContainer.init = function(self)
self.ignore_events = {"touch", "swipe", "hold", "hold_pan", "hold_release", "pan", "pan_release"}
end
local nope = function() return false end
MovableContainer.onMovableSwipe = nope
MovableContainer.onMovableHold = nope
MovableContainer.onMovableHoldPan = nope
MovableContainer.onMovableHoldRelease = nope
@equwal
equwal / 2-dict-auto-copy-current-definition.lua
Created May 3, 2024 07:55
Possibility to share and/or copy into the clipboard dictionary definitions. #9336; download and remove the .txt extension.
local Device = require("device")
local DictQuickLookup = require("ui/widget/dictquicklookup")
local changeDictionary_orig = DictQuickLookup.changeDictionary
DictQuickLookup.changeDictionary = function(self, index, skip_update)
changeDictionary_orig(self, index, skip_update)
local text = self.displayword .. "\n" .. self.definition
Device.input.setClipboardText(text)
end
@equwal
equwal / 2-cre-rotate-japanese-book.lua
Created May 3, 2024 07:51
Rotate books (suggested to rotate the font too separately)
local Blitbuffer = require("ffi/blitbuffer")
local ReaderRolling = require("apps/reader/modules/readerrolling")
local Screen = require("device").screen
local logger = require("logger")
ReaderRolling.onPreRenderDocument = function(self)
-- Only enable these hacks when the typography language has been set to Japanese.
if self.ui.typography.text_lang_tag ~= "ja" then
return
end
@equwal
equwal / tag-gen.ros
Last active September 19, 2020 18:42
Tags generator cron job
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
(progn ;;init forms
(ros:ensure-asdf)
#+quicklisp(ql:quickload '() :silent t)
)
@equwal
equwal / dwm-programmerkbd-6.2.diff
Created March 31, 2020 14:18
dwm patch for "programming" keyboard layouts with a flipped top row. Note that non-US users may need to make modifications to which punctuation is used.
config.h | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/config.h b/config.h
index fcb39fd..810b05b 100644
--- a/config.h
+++ b/config.h
@@ -19,7 +19,7 @@ static const char *colors[][3] = {
};
@equwal
equwal / uni.bib
Last active March 31, 2020 05:16
A large number of bibliography entries from my experiences.
@String{pub-AW = "Ad{\-d}i{\-s}on-Wes{\-l}ey"}
@String{pub-AW:adr = "Reading, MA, USA"}
@xdata{els,
journaltitle = "European Lisp Symposium",
organization = "European Lisp Symposium",
shortjournal = "ELS"
}
@xdata{els18,
@equwal
equwal / dijkstra.bib
Created March 29, 2020 13:17
All of Dijkstra's EWDs available as bibtex bibliography, from the uctexas archive webpage
@phdthesis{EWD:EWDthesis,
author = "Edsger W. Dijkstra",
title = "Communication with an {A}utomatic {C}omputer",
year = "1959",
publisher = "Excelsior",
school = "University of Amsterdam",
url = "http://www.cs.utexas.edu/users/EWD/PhDthesis/PhDthesis.PDF",
fileSize = 5263 KB
}
@techreport{EWD:CR1956.008,