This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name YouTube Subtitle Toggle (EN/KR) | |
| // @namespace https://example.com/ | |
| // @version 0.1 | |
| // @description Toggle English and Korean subtitles on YouTube with the "s" key. | |
| // @match https://www.youtube.com/* | |
| // @match https://m.youtube.com/* | |
| // @match https://youtu.be/* | |
| // @run-at document-end | |
| // @grant none |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; helper functions | |
| (defun mklist (obj) | |
| "Ensure obj is a list" | |
| (if (listp obj) obj (list obj))) | |
| (defmacro o (&rest fs) | |
| "Macro for composition of functions. Takes a list of functions and produces | |
| a closure as expected: | |
| (o identity (- 12) 1+) => (lambda (&rest args) (identity (- 12 (1+ ,@args)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defparameter *tape* '()) | |
| (defparameter *deltas* '()) | |
| (defparameter *tape-pos* 0) | |
| (defparameter *q* 0) | |
| (define-condition no-delta (error) | |
| ((text :initarg :text :accessor text))) | |
| (defun final-statep (final-states) | |
| "checks whether current state *q* is a final state" |