aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emacs/.emacs.d/init/ycp-editing.el5
-rw-r--r--emacs/.emacs.d/init/ycp-emms.el7
-rw-r--r--emacs/.emacs.d/init/ycp-markup.el1
-rw-r--r--emacs/.emacs.d/init/ycp-org.el4
-rw-r--r--emacs/.emacs.d/init/ycp-reading.el4
-rw-r--r--emacs/.emacs.d/init/ycp-theme.el1
-rw-r--r--emacs/.emacs.d/init/ycp-time.el4
-rw-r--r--emacs/.emacs.d/init/ycp-web.el1
-rw-r--r--emacs/.emacs.d/lisp/my/belf.el191
-rw-r--r--emacs/.emacs.d/lisp/my/my-editing.el29
-rw-r--r--emacs/.emacs.d/lisp/my/my-emms.el138
-rw-r--r--emacs/.emacs.d/lisp/my/my-epub.el75
-rw-r--r--emacs/.emacs.d/lisp/my/my-libgen.el28
-rw-r--r--emacs/.emacs.d/lisp/my/my-net.el1
-rw-r--r--emacs/.emacs.d/lisp/my/my-nov.el106
-rw-r--r--emacs/.emacs.d/lisp/my/my-org-remark.el65
-rw-r--r--emacs/.emacs.d/lisp/my/my-org.el23
-rw-r--r--emacs/.emacs.d/lisp/my/my-web.el4
-rw-r--r--manual/singlefile-settings.json185
-rwxr-xr-xmisc/bin/unzipall.sh8
-rwxr-xr-xmisc/bin/zipall.sh9
21 files changed, 804 insertions, 85 deletions
diff --git a/emacs/.emacs.d/init/ycp-editing.el b/emacs/.emacs.d/init/ycp-editing.el
index d497f42..031ae31 100644
--- a/emacs/.emacs.d/init/ycp-editing.el
+++ b/emacs/.emacs.d/init/ycp-editing.el
@@ -31,7 +31,10 @@
(setq-default truncate-lines nil)
(setq kill-do-not-save-duplicates t)
(setq kill-transform-function
- (lambda (s) (when (string-match-p "[^ \t\n]" s) s)))
+ (lambda (s) (when (or
+ (derived-mode-p 'pdf-view-mode)
+ (string-match-p "[^ \t\n]" s))
+ s)))
(setq bidi-inhibit-bpa t)
(setq save-interprogram-paste-before-kill t)
(setq kill-ring-max 200)
diff --git a/emacs/.emacs.d/init/ycp-emms.el b/emacs/.emacs.d/init/ycp-emms.el
index 2b52b17..e49209f 100644
--- a/emacs/.emacs.d/init/ycp-emms.el
+++ b/emacs/.emacs.d/init/ycp-emms.el
@@ -34,6 +34,7 @@
(emms-all)
(setq emms-playing-time-resume-from-last-played t)
(add-to-list 'emms-info-functions 'emms-info-ytdl)
+ (add-to-list 'emms-info-functions 'my-emms-info-ffprobe)
;; emms-info-native is not very useful
(delete 'emms-info-native emms-info-functions)
(setq emms-source-file-default-directory (locate-user-emacs-file "emms"))
@@ -46,6 +47,7 @@
(setq emms-source-file-directory-tree-function
'emms-source-file-directory-tree-find)
(setq emms-info-ytdl-using-torsocks t)
+ (setq emms-info-auto-update nil)
(add-hook 'emms-playlist-mode-hook #'hl-line-mode)
(add-hook 'emms-metaplaylist-mode-hook #'hl-line-mode)
)
@@ -92,12 +94,17 @@
'my-emms-output-current-track-to-i3bar-file)
(add-hook 'emms-player-finished-hook 'my-emms-score-up-playing)
(add-hook 'emms-player-started-hook 'my-emms-score-up-chosen-bonus)
+ (add-hook 'emms-player-started-hook 'my-emms-playlist-maybe-mark-bounds)
+ (add-hook 'emms-player-started-hook 'my-emms-maybe-get-duration-for-current-track)
(setq emms-player-next-function 'my-emms-next-track-or-random-group)
(setq emms-players-preference-f 'my-emms-players-preference)
(my-keybind dired-mode-map "e" #'my-dired-add-to-emms)
(my-override emms-track-simple-description)
(my-emms-add-all)
(my-timer emms-save-scores-timer nil 900 'emms-score-save-hash)
+ (my-override emms-mode-line-playlist-current)
+ (my-override emms-score-show-playing)
+ ;; (my-override emms-playing-time-mode-line)
)
(provide 'ycp-emms)
diff --git a/emacs/.emacs.d/init/ycp-markup.el b/emacs/.emacs.d/init/ycp-markup.el
index 6a6e8b8..c90dc6a 100644
--- a/emacs/.emacs.d/init/ycp-markup.el
+++ b/emacs/.emacs.d/init/ycp-markup.el
@@ -115,6 +115,7 @@
(my-keybind nov-mode-map
"Q" #'my-nov-copy-buffer-file-with-staging
"i" #'imenu)
+ (add-to-list 'nov-shr-rendering-functions '(span . my-nov-render-span))
)
;;; json-mode
diff --git a/emacs/.emacs.d/init/ycp-org.el b/emacs/.emacs.d/init/ycp-org.el
index 43ae6cb..001dbe0 100644
--- a/emacs/.emacs.d/init/ycp-org.el
+++ b/emacs/.emacs.d/init/ycp-org.el
@@ -306,6 +306,7 @@
(setq org-clock-idle-time 15)
(setq org-clock-mode-line-total 'auto)
(setq org-clock-persist 'history)
+ (setq org-clock-continuously t)
(org-clock-persistence-insinuate))
(my-package org-refile
@@ -528,6 +529,9 @@
(require 'my-org-remark)
(setq org-remark-notes-display-buffer-action
'(display-buffer-reuse-mode-window))
+ (setq org-remark-notes-file-name
+ (locate-user-emacs-file "margin.org"))
+ (my-override org-remark-highlight-add-or-update-highlight-headline)
(require 'nov)
(my-keybind nov-mode-map
"M-n" #'org-remark-next
diff --git a/emacs/.emacs.d/init/ycp-reading.el b/emacs/.emacs.d/init/ycp-reading.el
index 24c47d0..5c0284e 100644
--- a/emacs/.emacs.d/init/ycp-reading.el
+++ b/emacs/.emacs.d/init/ycp-reading.el
@@ -27,6 +27,8 @@
;;; Code:
(my-package belf
- (my-setq-from-local belf-dir))
+ (my-setq-from-local belf-dir belf-locate-dirs)
+ (add-hook 'find-file-hook 'belf-recent-add-current)
+ (blink-cursor-mode 0))
(provide 'ycp-reading)
diff --git a/emacs/.emacs.d/init/ycp-theme.el b/emacs/.emacs.d/init/ycp-theme.el
index ee76311..c6721ed 100644
--- a/emacs/.emacs.d/init/ycp-theme.el
+++ b/emacs/.emacs.d/init/ycp-theme.el
@@ -41,6 +41,7 @@
'normal :weight 'normal :height 150 :width 'normal)
(set-face-attribute 'fixed-pitch nil :family "Ubuntu Mono" :foundry "DAMA"
:slant 'normal :weight 'normal :height 150 :width 'normal)
+(set-face-attribute 'variable-pitch nil :family "Ubuntu" :foundry "DAMA")
(provide 'ycp-theme)
;;; ycp-theme.el ends here
diff --git a/emacs/.emacs.d/init/ycp-time.el b/emacs/.emacs.d/init/ycp-time.el
index f98a9cd..f21061c 100644
--- a/emacs/.emacs.d/init/ycp-time.el
+++ b/emacs/.emacs.d/init/ycp-time.el
@@ -83,7 +83,7 @@
(holiday-fixed 1 26 "Australia Day (Vic holiday)")
(holiday-float 3 1 2 "Labour Day (Vic holiday)")
(holiday-fixed 4 25 "Anzac Day (Vic holiday)")
- (holiday-float 6 1 2 "Monarch's Birthday (Vic oliday)")
+ (holiday-float 6 1 2 "Monarch's Birthday (Vic holiday)")
(holiday-fixed 6 30 "End of financial year")
(holiday-float 9 5 -1 "(Possibly) Friday before the AFL Grand Final (Vic holiday)")
(holiday-float 10 5 1 "(Possibly) Friday before the AFL Grand Final (Vic holiday)")
@@ -123,7 +123,7 @@
(setq appt-display-interval 5)
;; dbus notification of appt
(require 'my-time)
- (setq appt-disp-window-function #'my-app-display-window)
+ (setq appt-disp-window-function #'my-appt-display-window)
;; with org-agenda-to-appt
(require 'org-clock)
(require 'my-utils)
diff --git a/emacs/.emacs.d/init/ycp-web.el b/emacs/.emacs.d/init/ycp-web.el
index 6e939f8..67c5e5a 100644
--- a/emacs/.emacs.d/init/ycp-web.el
+++ b/emacs/.emacs.d/init/ycp-web.el
@@ -252,6 +252,7 @@
(my-package my-web
(:delay 60)
+ (my-setq-from-local my-webpage-download-dir)
(my-keybind eww-mode-map
"N" #'my-eww-next-path
"P" #'my-eww-prev-path
diff --git a/emacs/.emacs.d/lisp/my/belf.el b/emacs/.emacs.d/lisp/my/belf.el
index 35175be..0db79f6 100644
--- a/emacs/.emacs.d/lisp/my/belf.el
+++ b/emacs/.emacs.d/lisp/my/belf.el
@@ -28,6 +28,7 @@
(require 'tabulated-list)
(require 'infobox)
+(require 'my-epub)
(defvar-keymap belf-mode-map
:parent tabulated-list-mode-map
@@ -76,7 +77,7 @@
(defvar belf-dir "~/Documents" "Directory of books.")
-(defun belf-parse-all-file-names ()
+(defun belf-parse-file-names (file-names)
(seq-filter
#'identity
(seq-map
@@ -84,7 +85,10 @@
(when-let ((parsed (belf-parse-file-name f)))
(let-alist parsed
(list f (vector .authors .title .year)))))
- (directory-files belf-dir t "\\.\\(epub\\|pdf\\|cbr\\|djvu\\|mobi\\)$"))))
+ file-names)))
+
+(defun belf-parse-all-file-names ()
+ (belf-parse-file-names (directory-files belf-dir t "\\.\\(epub\\|pdf\\|cbr\\|djvu\\|mobi\\|azw3\\)$")))
(defun belf-file-name-desort (file-name new-dir)
"Rename a file.
@@ -147,47 +151,21 @@ foo bar & quux, baf"
(belf-epub-rename epub new-dir)))
(defun belf-epub-rename (file-name new-dir)
- (when-let ((content-file-name (belf-epub-content-file-name file-name)))
- (with-temp-buffer
- (call-process "unzip" nil t nil "-p" file-name content-file-name)
- (let* ((dom (libxml-parse-xml-region (point-min) (point-max)))
- (metadata (dom-by-tag dom 'metadata))
- (title (dom-text (dom-by-tag metadata 'title)))
- (authors (dom-texts (dom-by-tag metadata 'creator) ", "))
- (identifier
- (replace-regexp-in-string
- "[^0-9,]" ""
- (dom-texts
- (seq-filter
- (lambda (node)
- (or (equal "ISBN" (dom-attr node 'scheme))
- (string-match-p "^[0-9]+$" (dom-text node))))
- (dom-by-tag metadata 'identifier))
- ",")))
- (date (replace-regexp-in-string
- "[^0-9]" ""
- (dom-text (dom-by-tag metadata 'date))))
- (year (substring date 0 (min 4 (length date))))
- (dir (file-name-directory file-name))
- (new-base-name (belf-format-base-name
- `((title . ,title)
- (authors . ,authors)
- (year . ,year)
- (identifier . ,identifier))
- new-dir))
- new-name)
- ;; (pp metadata)
- (dolist (file (directory-files dir t
- (format "^%s\\.[a-zA-Z0-9]+$"
- (regexp-quote
- (file-name-base file-name)))))
- (setq new-name (format "%s.%s" new-base-name (file-name-extension file)))
- (unless (equal file-name new-name)
- (message "%s -> %s" file new-name)
- (ignore-error 'file-already-exists (rename-file file new-name))
- )
+ (when-let ((meta (my-epub-metadata file-name)))
+ (let* ((dir (file-name-directory file-name))
+ (new-base-name (belf-format-base-name meta new-dir))
+ new-name)
+ (dolist (file (directory-files dir t
+ (format "^%s\\.[a-zA-Z0-9]+$"
+ (regexp-quote
+ (file-name-base file-name)))))
+ (setq new-name (format "%s.%s" new-base-name (file-name-extension file)))
+ (unless (equal file-name new-name)
+ (message "%s -> %s" file new-name)
+ (ignore-error 'file-already-exists (rename-file file new-name))
)
- ))
+ )
+ )
))
(defun belf-move-invalid-file-names (dir new-dir)
@@ -201,6 +179,14 @@ foo bar & quux, baf"
(rename-file file-name new-name)
))))
+(defun belf-dired-do-epub-rename ()
+ (interactive)
+ (seq-do
+ (lambda (file)
+ (when (equal (upcase (file-name-extension file)) "EPUB")
+ (belf-epub-rename file (file-name-directory file))))
+ (dired-get-marked-files)))
+
(defun belf-epub-rename-at-point ()
(interactive)
(let ((file-name (tabulated-list-get-id)))
@@ -242,15 +228,6 @@ foo bar & quux, baf"
(json-read)))
)
-(defun belf-epub-content-file-name (file-name)
- (with-temp-buffer
- (if (eq 0 (call-process "unzip" nil t nil
- "-p" file-name "META-INF/container.xml"))
- (let ((dom (libxml-parse-xml-region (point-min) (point-max))))
- (dom-attr (dom-by-tag (dom-by-tag (dom-by-tag dom 'container) 'rootfiles) 'rootfile) 'full-path))
- (message "Failed to extract container.xml: %s" (buffer-string))
- nil)))
-
(defun belf-epub-cover-file-name (file-name content-file-name)
(with-temp-buffer
(call-process "unzip" nil t nil "-p" file-name content-file-name)
@@ -352,12 +329,13 @@ For EPUB, looks for a cover image in the file."
(alist-get 'authors (belf-parse-file-name
(tabulated-list-get-id))))))
(let* ((file-name (tabulated-list-get-id))
+ (dir (file-name-directory file-name))
(parsed (belf-parse-file-name file-name))
new-base-name
new-file)
(setf (alist-get 'authors parsed) new-authors)
- (setq new-base-name (belf-format-base-name parsed))
- (dolist (file (directory-files belf-dir t
+ (setq new-base-name (belf-format-base-name parsed dir))
+ (dolist (file (directory-files dir t
(format "^%s\\.[a-zA-Z0-9]+$"
(regexp-quote
(file-name-base file-name)))))
@@ -448,4 +426,111 @@ Compare without leading \"The \"."
(interactive)
(find-file-other-window (tabulated-list-get-id)))
+;;; belf-recent
+
+(defvar belf-recent-file (locate-user-emacs-file "belf-list"))
+
+(defun belf-recent-add (file)
+ "Add FILE to `belf-recent-file'.
+
+Can be used as a `find-file-hook'."
+ (when (string-match-p "\\.\\(epub\\|pdf\\|cbr\\|djvu\\|mobi\\|azw3\\)$"
+ file)
+ (with-temp-buffer
+ (when (file-exists-p belf-recent-file)
+ (insert-file-contents belf-recent-file))
+ (goto-char (point-min))
+ (flush-lines (rx-to-string `(and bol "[" (= 23 anychar) "] " ,file eol)))
+ (insert
+ (format-time-string "[%Y-%m-%d %a %H:%M:%S]" (current-time))
+ " "
+ file
+ "\n")
+ (write-file belf-recent-file)
+ )))
+
+(defun belf-recent-add-current ()
+ (when buffer-file-name
+ (belf-recent-add buffer-file-name)))
+
+(define-derived-mode belf-recent-mode belf-mode "Bookshelf Recent"
+ "Major mode for browsing a list of books."
+ (setq revert-buffer-function #'belf-recent-list-refresh-contents))
+
+(defun belf-recent ()
+ (interactive)
+ (let ((buf (get-buffer-create "*Bookshelf Recent*")))
+ (with-current-buffer buf
+ (belf-recent-mode)
+ (belf-recent-list-refresh-contents))
+ (pop-to-buffer-same-window buf)))
+
+;; (defvar belf-find-dir nil
+;; "Directory to run find command for relocated files.")
+
+(defvar belf-locate-dirs nil
+ "Directories to look for relocated files.")
+
+(defun belf-recent-bookkeeping ()
+ "Check `belf-recent-file' for (re)moved files and update accordingly."
+ (interactive)
+ (copy-file belf-recent-file (concat belf-recent-file ".bak") t)
+ (with-temp-buffer
+ (when (file-exists-p belf-recent-file)
+ (insert-file-contents belf-recent-file))
+ (goto-char (point-min))
+ (while (not (eobp))
+ (forward-char 26)
+ (let* ((beg (point))
+ (end (progn (end-of-line) (point)))
+ (file-name (buffer-substring-no-properties beg end)))
+ (unless (file-exists-p file-name)
+ (let ((dirs belf-locate-dirs)
+ (file-name-nodir (file-name-nondirectory file-name))
+ dir new-name found)
+ (delete-region beg end)
+ (while (and (not found) dirs)
+ (setq dir (expand-file-name (car dirs))
+ new-name (file-name-concat dir file-name-nodir)
+ found (file-exists-p new-name)
+ dirs (cdr dirs)))
+ (when found (insert new-name)))
+ ;; Running find on a big dir is too slow even when there are
+ ;; only a few thousands subdirs
+ ;; (call-process "find" nil (current-buffer) nil
+ ;; (expand-file-name belf-find-dir)
+ ;; "-name" (file-name-nondirectory file-name))
+ )
+ (beginning-of-line 2)))
+
+ ;; Remove empty records that could not be found
+ (goto-char (point-min))
+ (flush-lines (rx bol (= 26 anychar) eol))
+
+ ;; Deduplicate
+ (goto-char (point-min))
+ (while (not (eobp))
+ (forward-char 26)
+ (let* ((beg (point))
+ (end (progn (end-of-line) (point)))
+ (file-name (buffer-substring-no-properties beg end)))
+ (flush-lines
+ (rx-to-string `(and bol "[" (= 23 anychar) "] " ,file-name eol))))
+ (beginning-of-line 2))
+ (write-file belf-recent-file)))
+
+(defun belf-recent-list-refresh-contents (&rest _)
+ (belf-recent-bookkeeping)
+ (setq-local tabulated-list-entries (belf-recent-parse-file-names))
+ (tabulated-list-print))
+
+(defun belf-recent-parse-file-names ()
+ (with-temp-buffer
+ (when (file-exists-p belf-recent-file)
+ (insert-file-contents belf-recent-file))
+ (goto-char (point-min))
+ (replace-regexp (rx bol (= 26 anychar)) "")
+ (belf-parse-file-names (string-lines (buffer-string))))
+ )
+
(provide 'belf)
diff --git a/emacs/.emacs.d/lisp/my/my-editing.el b/emacs/.emacs.d/lisp/my/my-editing.el
index 0775063..e6499ff 100644
--- a/emacs/.emacs.d/lisp/my/my-editing.el
+++ b/emacs/.emacs.d/lisp/my/my-editing.el
@@ -528,7 +528,7 @@ With an prefix-arg, copy the file name relative to project root."
(interactive)
(let ((old-max (point-max))
(old-point (point)))
- (comment-kill (or n 1))
+ (when comment-start (comment-kill (or n 1)))
(when (= old-max (point-max))
(goto-char old-point)
(kill-sexp n))))
@@ -546,11 +546,32 @@ With an prefix-arg, copy the file name relative to project root."
(defun my-elide-region (b e)
(interactive "r")
- (let ((message-elide-ellipsis (concat comment-start
- " [... %l lines elided]
-")))
+ (let ((message-elide-ellipsis
+ (if (> 1 (count-lines b (min (1+ e) (point-max))))
+ (concat comment-start
+ " [... %l lines elided]
+")
+ (format " [... %d words elided]" (count-words b e)))))
(message-elide-region b e)))
+(defun my-elide-text (text limit)
+ "Elide TEXT to about LIMIT characters."
+ (let ((keep (- limit 25)))
+ (when (< keep 0)
+ (error "Too few characters to limit to. Should be at least 25."))
+ (with-temp-buffer
+ (insert text)
+ (goto-char (point-min))
+ (while (and (<= (point) keep) (< (point) (point-max)))
+ (forward-word))
+ (cond ((> (point) keep)
+ (backward-word)
+ (my-elide-region (point) (point-max))
+ (buffer-string))
+ (t text))
+ ))
+ )
+
(defun my-replace-no-filter (old-fun &rest r)
(let ((search-invisible t))
(apply old-fun r)))
diff --git a/emacs/.emacs.d/lisp/my/my-emms.el b/emacs/.emacs.d/lisp/my/my-emms.el
index e77089d..e8be5ee 100644
--- a/emacs/.emacs.d/lisp/my/my-emms.el
+++ b/emacs/.emacs.d/lisp/my/my-emms.el
@@ -464,26 +464,88 @@ under /zzz-seren/."
(min end-ln maybe-group-end))))
(cons group-start group-end))))
+(defvar-local my-emms-playlist-group-start-overlay nil)
+(defvar-local my-emms-playlist-group-end-overlay nil)
+
+(defun my-emms-playlist-mark-bounds (group-end)
+ "Mark bounds of the current track group.
+
+An up arrow at the first played in the current group, and a down
+arrow at the end of the track group."
+ (when my-emms-playlist-group-start-overlay
+ (delete-overlay my-emms-playlist-group-start-overlay))
+ (when my-emms-playlist-group-start-overlay
+ (delete-overlay my-emms-playlist-group-end-overlay))
+ (setq my-emms-playlist-group-start-overlay (make-overlay (point) (point)))
+ (overlay-put
+ my-emms-playlist-group-start-overlay
+ 'before-string (propertize
+ "x" 'display
+ `(left-fringe up-arrow emms-playlist-selected-face)))
+ (save-excursion
+ (goto-line (1- group-end))
+ (setq my-emms-playlist-group-end-overlay (make-overlay (point) (point)))
+ (overlay-put
+ my-emms-playlist-group-end-overlay
+ 'before-string (propertize
+ "x" 'display
+ `(left-fringe down-arrow emms-playlist-selected-face)))))
+
+(defun my-emms-mode-line-playlist-current ()
+ "Format the currently playing song.
+
+Override `emms-mode-line-playlist-current' to incorporate wide chars."
+ (let ((track-desc (my-emms-get-display-name-1
+ (emms-track-description
+ (emms-playlist-current-selected-track)))))
+ (format emms-mode-line-format
+ (if (< (string-width track-desc) emms-mode-line-length-limit)
+ track-desc
+ (concat
+ (seq-subseq
+ track-desc 0
+ (- (length track-desc)
+ (- (string-width track-desc) emms-mode-line-length-limit)))
+ "...")))))
+
+
+;; (defun my-emms-playing-time-mode-line ()
+;; "Add playing time to the mode line.
+
+;; Override `emms-playing-time-mode-line': prepend instead of append."
+;; (or global-mode-string (setq global-mode-string '("")))
+;; (unless (member 'emms-playing-time-string
+;; global-mode-string)
+;; (setq global-mode-string
+;; (append '(emms-playing-time-string) global-mode-string))))
+
+
(defun my-emms-playlist-random-group ()
(interactive)
(with-current-emms-playlist
- (remove-overlays)
- (goto-line (1+ (random (count-lines (point-min) (point-max)))))
- (pcase-let ((`(,group-start . ,group-end) (my-emms-playlist-group-bounds)))
- (goto-line group-start)
- (overlay-put
- (make-overlay (point) (point))
- 'before-string (propertize
- "x" 'display
- `(left-fringe down-arrow emms-playlist-selected-face)))
- (save-excursion
- (goto-line (1- group-end))
- (overlay-put
- (make-overlay (point) (point))
- 'before-string (propertize
- "x" 'display
- `(left-fringe up-arrow emms-playlist-selected-face))))
- (emms-playlist-mode-play-current-track))))
+ (let ((random-line (1+ (random (count-lines (point-min) (point-max))))))
+ (goto-line random-line)
+ (pcase-let ((`(,group-start . ,group-end) (my-emms-playlist-group-bounds)))
+ (message "my-emms-playlist-random-group: (%d, %d)" random-line group-start)
+ (goto-line group-start)
+ (my-emms-playlist-mark-bounds group-end)
+ (emms-playlist-mode-play-current-track)))))
+
+;;; TODO: mark bounds if and only if the currently played is out of
+;;; the existing overlay.
+(defun my-emms-playlist-maybe-mark-bounds ()
+ "Used as an `emms-player-started-hook'.
+
+If the last command is `emms-playlist-mode-play-smart' i.e. the
+user manually chose the track to play, and if
+`emms-player-next-function' is
+`my-emms-next-track-or-random-group', then mark boundaries since
+it would not have been marked otherwise."
+ (when (and (eq last-command 'emms-playlist-mode-play-smart)
+ (eq emms-player-next-function 'my-emms-next-track-or-random-group))
+ (with-current-emms-playlist
+ (pcase-let ((`(_ . ,group-end) (my-emms-playlist-group-bounds)))
+ (my-emms-playlist-mark-bounds group-end)))))
(defun my-emms-next-track-or-random-group ()
(interactive)
@@ -563,12 +625,22 @@ character."
(defvar my-emms-score-delta 1)
(defun my-emms-score-up-playing ()
- "Increase score by `my-emms-score-delta', then reset it to 1."
+ "Increase score by `my-emms-score-delta', then reset the score delta to 1."
(emms-score-change-score
my-emms-score-delta
(my-emms-get-display-name-1 (emms-score-current-selected-track-filename)))
(setq my-emms-score-delta 1))
+(defun my-emms-score-show-playing ()
+ "Show score for current playing track in minibuf.
+
+Override `emms-score-show-playing' - using last three components in the name..."
+ (interactive)
+ (message "track/tolerance score: %d/%d"
+ (emms-score-get-score (my-emms-get-display-name-1
+ (emms-score-current-selected-track-filename)))
+ emms-score-min-score))
+
(defun my-emms-score-up-chosen-bonus ()
"Bonus score up if the track is started intentionally.
@@ -581,14 +653,40 @@ If the last command is `emms-playlist-mode-play-smart', then set
)
(defun my-emms-wrapped ()
- "Print top 5 scored tracks."
+ "Print top 10 scored tracks."
(interactive)
(let (keys)
(maphash (lambda (k _) (push k keys)) emms-score-hash)
(sort keys (lambda (k1 k2)
(> (cl-second (gethash k1 emms-score-hash))
(cl-second (gethash k2 emms-score-hash)))))
- (message "Top 5: %s" (string-join (take 5 keys) "\n"))))
+ (message "Top 10: %s" (string-join (take 10 keys) "\n"))))
+
+(defun my-emms-maybe-get-duration-for-current-track ()
+ "Get duration for the current track.
+
+Can be used as a `emms-player-started-hook'"
+ (unless (emms-track-get (emms-playlist-current-selected-track)
+ 'info-playing-time)
+ (my-emms-info-ffprobe (emms-playlist-current-selected-track))))
+
+(defun my-emms-info-ffprobe (track)
+ "Use ffprobe for urls to get duration.
+
+Call
+
+ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1
+
+on the url"
+ (when (eq (emms-track-type track) 'url)
+ (with-temp-buffer
+ (call-process "ffprobe" nil t nil "-v" "error" "-show_entries"
+ "format=duration" "-of" "default=noprint_wrappers=1:nokey=1"
+ (emms-track-name track))
+ (let ((duration (string-trim (buffer-string))))
+ (when (string-match-p "[0-9.]+" duration)
+ (emms-track-set track 'info-playing-time
+ (floor (string-to-number duration))))))))
(provide 'my-emms)
;;; my-emms.el ends here
diff --git a/emacs/.emacs.d/lisp/my/my-epub.el b/emacs/.emacs.d/lisp/my/my-epub.el
new file mode 100644
index 0000000..4a3dfca
--- /dev/null
+++ b/emacs/.emacs.d/lisp/my/my-epub.el
@@ -0,0 +1,75 @@
+;;; my-epub.el -- epub utils -*- lexical-binding: t -*-
+
+;; Copyright (C) 2025 Free Software Foundation, Inc.
+
+;; Author: Yuchen Pei <id@ypei.org>
+;; Package-Requires: ((emacs "30.1"))
+
+;; This file is part of dotted.
+
+;; dotted is free software: you can redistribute it and/or modify it under
+;; the terms of the GNU Affero General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; dotted is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
+;; Public License for more details.
+
+;; You should have received a copy of the GNU Affero General Public
+;; License along with dotted. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; epub utils.
+
+;;; Code:
+
+
+(defun my-epub-content-file-name (file-name)
+ (with-temp-buffer
+ (if (eq 0 (call-process "unzip" nil t nil
+ "-p" file-name "META-INF/container.xml"))
+ (let ((dom (libxml-parse-xml-region (point-min) (point-max))))
+ (dom-attr
+ (dom-by-tag
+ (dom-by-tag (dom-by-tag dom 'container) 'rootfiles)
+ 'rootfile)
+ 'full-path))
+ (message "Failed to extract container.xml: %s" (buffer-string))
+ nil)))
+
+(defun my-epub-metadata (file-name)
+ "Get metadata of an epub file."
+ (when-let ((content-file-name (my-epub-content-file-name file-name)))
+ (with-temp-buffer
+ (call-process "unzip" nil t nil "-p" file-name content-file-name)
+ (let* ((dom (libxml-parse-xml-region (point-min) (point-max)))
+ (metadata (dom-by-tag dom 'metadata))
+ (title (dom-text (dom-by-tag metadata 'title)))
+ (authors (dom-texts (dom-by-tag metadata 'creator) ", "))
+ (identifier
+ (replace-regexp-in-string
+ "[^0-9,]" ""
+ (dom-texts
+ (seq-filter
+ (lambda (node)
+ (or (equal "ISBN" (dom-attr node 'scheme))
+ (string-match-p "^[0-9]+$" (dom-text node))))
+ (dom-by-tag metadata 'identifier))
+ ",")))
+ (date (replace-regexp-in-string
+ "[^0-9]" ""
+ (dom-text (dom-by-tag metadata 'date))))
+ (year (substring date 0 (min 4 (length date)))))
+ `((title . ,title)
+ (authors . ,authors)
+ (year . ,year)
+ (identifier . ,identifier))
+ ;; (pp metadata)
+ ))
+ ))
+
+(provide 'my-epub)
+;;; my-epub.el ends here
diff --git a/emacs/.emacs.d/lisp/my/my-libgen.el b/emacs/.emacs.d/lisp/my/my-libgen.el
index c1f430f..d4efb30 100644
--- a/emacs/.emacs.d/lisp/my/my-libgen.el
+++ b/emacs/.emacs.d/lisp/my/my-libgen.el
@@ -186,6 +186,25 @@
nil
(lambda () (my-libgen-check-md5 filename md5)))))
+(defun my-libgen-plus-edition-infobox (edition-id)
+ (let ((dom (my-url-fetch-dom
+ (format "%s/edition.php?id=%s" my-libgen-plus-host edition-id))))
+ (infobox-render-string
+ (with-temp-buffer
+ (insert (mapconcat (lambda (p) (dom-texts p ""))
+ (dom-by-tag (dom-by-class dom "order-2") 'p) "\n"))
+ (shr-insert-document (dom-by-class dom "order-5"))
+ (buffer-string))
+ `(my-libgen-plus-edition-infobox ,edition-id)
+ (called-interactively-p 'interactive)
+ )
+ ))
+
+(defun my-libgen-plus-infobox-action ()
+ (interactive)
+ (my-libgen-plus-edition-infobox
+ (alist-get 'edition-id (get-text-property (point) 'button-data))))
+
(defun my-libgen-check-md5 (file md5)
(let ((actual (substring (my-call-process-out "md5sum" file) 0 32)))
(unless (equal actual md5)
@@ -224,6 +243,7 @@
(let ((kmap (make-sparse-keymap)))
(set-keymap-parent kmap button-map)
(define-key kmap "d" 'my-libgen-plus-download-action)
+ (define-key kmap "i" 'my-libgen-plus-infobox-action)
;; (define-key kmap "t" 'my-libgen-download-onion-action)
;; (define-key kmap "p" 'my-libgen-show-more-info)
kmap))
@@ -323,6 +343,12 @@
(edition-id . ,edition-id)
(identifier . ,identifier)))))
+(defun my-libgen-plus-guess-md5 (mirrors)
+ (let ((joined
+ (string-join mirrors " ")))
+ (when (string-match "\\<[0-9a-f]\\{32\\}\\>" joined)
+ (match-string 0 joined))))
+
(defun my-libgen-plus-search-parse-tr (tr)
(let* ((tds (dom-by-tag tr 'td))
(title-id (my-libgen-plus-parse-title-id (elt tds 0)))
@@ -343,7 +369,7 @@
(mirrors-td (elt tds 8))
(mirrors (seq-map (lambda (mirror) (dom-attr mirror 'href))
(dom-by-tag mirrors-td 'a)))
- (md5 (when mirrors (substring (car mirrors) 4 36)))
+ (md5 (when mirrors (my-libgen-plus-guess-md5 mirrors)))
)
`((title . ,title)
(identifier . ,identifier)
diff --git a/emacs/.emacs.d/lisp/my/my-net.el b/emacs/.emacs.d/lisp/my/my-net.el
index 6212b50..b19ce68 100644
--- a/emacs/.emacs.d/lisp/my/my-net.el
+++ b/emacs/.emacs.d/lisp/my/my-net.el
@@ -29,6 +29,7 @@
;;; net utilities
(defvar my-download-dir "~/Downloads")
+(defvar my-webpage-download-dir "~/Downloads")
(defmacro my-url-as-googlebot (&rest body)
"Run BODY while spoofing as googlebot"
diff --git a/emacs/.emacs.d/lisp/my/my-nov.el b/emacs/.emacs.d/lisp/my/my-nov.el
index 9a819c7..d43a8f3 100644
--- a/emacs/.emacs.d/lisp/my/my-nov.el
+++ b/emacs/.emacs.d/lisp/my/my-nov.el
@@ -41,10 +41,18 @@ chapter title."
;; this shouldn't happen for properly authored EPUBs
(when (not title)
(setq title "No title"))
+ ;; TODO: fix mode line update
(setq mode-line-buffer-identification
- (concat title ": " chapter-title))
+ (format "%s: %s (%d%%)"
+ title chapter-title
+ (/ (* 100 (my-nov-word-position)) my-nov-total-word-count)
+ ))
))
+(defun my-nov-render-span (dom)
+ (unless (equal (dom-attr dom 'epub:type) "pagebreak")
+ (shr-generic dom)))
+
(defun my-nov-find-file-with-ipath (file-name ipath)
"Find epub file and goto IPATH.
@@ -84,5 +92,101 @@ Useful for recoll."
(visual-line-mode)
)
+(defvar-local my-nov-document-word-counts nil
+ "Word count of each nov document.")
+
+(defvar-local my-nov-total-word-count nil
+ "Total word count of the epub.")
+
+(defun my-nov-count-words ()
+ (interactive)
+ (unless my-nov-document-word-counts
+ (message "Counting words...")
+ (setq my-nov-document-word-counts
+ (apply
+ 'vector
+ (seq-map
+ (lambda (doc)
+ (with-temp-buffer
+ (pcase-let ((`(,name . ,file) doc))
+ (insert-file-contents file)
+ (nov-render-html)
+ (cons name (count-words (point-min) (point-max))))))
+ nov-documents)))
+ (setq my-nov-total-word-count
+ (seq-reduce
+ (lambda (sum pair)
+ (+ sum (cdr pair)))
+ my-nov-document-word-counts
+ 0))
+ (message "Counting words...done")))
+
+(defun my-nov-stats ()
+ (interactive)
+ (message "%d words; %d standard pages"
+ my-nov-total-word-count
+ (ceiling (/ my-nov-total-word-count 300.0))))
+
+;;; TODO: also show current percentage in the total book in the mode
+;;; line
+(defun my-nov-goto-nth-word (n)
+ "Go to the nth word of the current epub."
+ (my-nov-count-words)
+ (setq nov-documents-index -1)
+ (let ((found
+ (seq-find
+ (lambda (pair)
+ (setq n (- n (cdr pair)))
+ (setq nov-documents-index (1+ nov-documents-index))
+ (<= n 0))
+ my-nov-document-word-counts)))
+ (nov-render-document)
+ (if (> n 0)
+ (end-of-buffer)
+ (forward-word (+ n (cdr found)))))
+ )
+
+(defun my-nov-word-position ()
+ "Where are we in terms of word position?
+
+Return n, such that nth word of the epub is at the beginning of the
+screen."
+ (my-nov-count-words)
+ (let ((result 0))
+ (dotimes (i nov-documents-index)
+ (setq result (+ result (cdr (aref my-nov-document-word-counts i)))))
+ (save-excursion
+ (move-to-window-line 0)
+ (setq result (+ result (count-words (point-min) (point)))))))
+
+(defun my-nov-skim-forward ()
+ "Forward by 3-10% of the book."
+ (interactive)
+ (let ((pc (+ 3 (random 8))))
+ (my-nov-goto-nth-word
+ (+ (my-nov-word-position)
+ (/ (* my-nov-total-word-count pc) 100)))
+ (message "Skimmed forward by %d%% of the book" pc)))
+
+(defun my-nov-skim-backward ()
+ "Backward by 3-10% of the book."
+ (interactive)
+ (let ((pc (+ 3 (random 8))))
+ (my-nov-goto-nth-word
+ (max
+ 0
+ (- (my-nov-word-position)
+ (/ (* my-nov-total-word-count pc) 100))))
+ (message "Skimmed backward by %d%% of the book" pc)))
+
+(defun my-nov-goto-random-position ()
+ "Goto a random position in the epub."
+ (interactive)
+ (my-nov-count-words)
+ (let ((n (random my-nov-total-word-count)))
+ (my-nov-goto-nth-word n)
+ (message "Went to the %dth word (%d%% of the book)."
+ n (/ (* n 100) my-nov-total-word-count))))
+
(provide 'my-nov)
;;; my-nov.el ends here
diff --git a/emacs/.emacs.d/lisp/my/my-org-remark.el b/emacs/.emacs.d/lisp/my/my-org-remark.el
index 3e0ef0a..4582f6c 100644
--- a/emacs/.emacs.d/lisp/my/my-org-remark.el
+++ b/emacs/.emacs.d/lisp/my/my-org-remark.el
@@ -26,6 +26,71 @@
;;; Code:
+
+;;; override `org-remark-highlight-add-or-update-highlight-headline'
+(defun my-org-remark-highlight-add-or-update-highlight-headline (highlight source-buf notes-buf)
+ "Add a new HIGHLIGHT headlne to the NOTES-BUF or update it.
+Return notes-props as a property list.
+
+HIGHLIGHT is an overlay from the SOURCE-BUF.
+
+Assume the current buffer is NOTES-BUF and point is placed on the
+beginning of source-headline, which should be one level up."
+ ;; Add org-remark-link with updated line-num as a property
+ (let (title beg end props id text filename link orgid org-remark-type other-props)
+ (with-current-buffer source-buf
+ (setq title (org-remark-highlight-get-title)
+ beg (overlay-start highlight)
+ end (overlay-end highlight)
+ props (overlay-properties highlight)
+ id (plist-get props 'org-remark-id)
+ org-remark-type (overlay-get highlight 'org-remark-type)
+ text (org-with-wide-buffer
+ (org-remark-highlight-headline-text highlight org-remark-type))
+ filename (org-remark-source-get-file-name
+ (org-remark-source-find-file-name))
+ link (run-hook-with-args-until-success
+ 'org-remark-highlight-link-to-source-functions filename beg)
+ orgid (org-remark-highlight-get-org-id beg)
+ other-props (org-remark-highlight-collect-other-props highlight))
+ ;; TODO ugly to add the beg end after setq above
+ (plist-put props org-remark-prop-source-beg (number-to-string beg))
+ (plist-put props org-remark-prop-source-end (number-to-string end))
+ (when link (plist-put props "org-remark-link" link))
+ (when other-props (setq props (append props other-props))))
+ ;;; Make it explicit that we are now in the notes-buf, though it is
+ ;;; functionally redundant.
+ (with-current-buffer notes-buf
+ (let ((highlight-headline (org-find-property org-remark-prop-id id))
+ ;; Assume point is at the beginning of the parent headline
+ (level (1+ (org-current-level))))
+ (if highlight-headline
+ (progn
+ (goto-char highlight-headline)
+ ;; Update the existing headline and position properties
+ ;; Don't update the headline text when it already exists.
+ ;; Let the user decide how to manage the headlines
+ ;; (org-edit-headline text)
+ (org-remark-notes-set-properties props))
+ ;; No headline with the marginal notes ID property. Create a new one
+ ;; at the end of the file's entry
+ (org-narrow-to-subtree)
+ (goto-char (point-max))
+ ;; Ensure to be in the beginning of line to add a new headline
+ (when (eolp) (open-line 1) (forward-line 1) (beginning-of-line))
+ ;; Create a headline
+ ;; Add a properties
+ (insert (concat (insert-char (string-to-char "*") level)
+ " " (my-elide-text text fill-column) "\n"))
+ ;; org-remark-original-text should be added only when this
+ ;; headline is created. No update afterwards
+ (plist-put props "org-remark-original-text" text)
+ (org-remark-notes-set-properties props)
+ (when (and orgid org-remark-use-org-id)
+ (insert (concat "[[id:" orgid "]" "[" title "]]"))))
+ (list :body (org-remark-notes-get-body)
+ :original-text text)))))
+
(defun my-org-remark-open-or-create ()
(interactive)
(if mark-active
diff --git a/emacs/.emacs.d/lisp/my/my-org.el b/emacs/.emacs.d/lisp/my/my-org.el
index f870d4f..e628c5b 100644
--- a/emacs/.emacs.d/lisp/my/my-org.el
+++ b/emacs/.emacs.d/lisp/my/my-org.el
@@ -1662,5 +1662,28 @@ dual relation link-back on that task."
(and (org-entry-get (point) "BLOCKED_BY")
(member (org-entry-get nil "TODO") org-not-done-keywords)))
+(defun my-org-clock-split ()
+ "Split the clock entry at the current line."
+ (interactive)
+ (let ((line (buffer-substring (line-beginning-position) (line-end-position))))
+ (unless (string-match org-element-clock-line-re line)
+ (error "Not at an org clock line"))
+ (let* ((start (match-string 1 line))
+ (end (match-string 2 line))
+ (mid (org-read-date t 'to-time nil "Split org clock at: " nil start)))
+ (back-to-indentation)
+ (kill-line)
+ (insert "CLOCK: [" start "]--")
+ (org-insert-time-stamp mid t t)
+ (org-clock-update-time-maybe)
+
+ (my-new-line-above-or-below)
+ (insert "CLOCK: ")
+ (org-insert-time-stamp mid t t)
+ (insert "--[" end "]")
+ (org-clock-update-time-maybe)
+ ))
+ )
+
(provide 'my-org)
;;; my-org.el ends here
diff --git a/emacs/.emacs.d/lisp/my/my-web.el b/emacs/.emacs.d/lisp/my/my-web.el
index d1eacb6..7c9c567 100644
--- a/emacs/.emacs.d/lisp/my/my-web.el
+++ b/emacs/.emacs.d/lisp/my/my-web.el
@@ -146,10 +146,10 @@ Useful for bypassing \"Enable JavaScript and cookies to continue\"."
(if no-overwrite
(my-make-unique-file-name
(my-make-file-name-from-url url)
- my-download-dir)
+ my-webpage-download-dir)
(expand-file-name
(my-make-file-name-from-url url "html")
- my-download-dir))))
+ my-webpage-download-dir))))
(url-copy-file url file-name (not no-overwrite))
(browse-url-firefox (format "file://%s" file-name))))
diff --git a/manual/singlefile-settings.json b/manual/singlefile-settings.json
new file mode 100644
index 0000000..3cdd2a8
--- /dev/null
+++ b/manual/singlefile-settings.json
@@ -0,0 +1,185 @@
+{
+ "profiles": {
+ "__Default_Settings__": {
+ "removeHiddenElements": true,
+ "removeUnusedStyles": true,
+ "removeUnusedFonts": true,
+ "removeFrames": true,
+ "blockScripts": true,
+ "blockVideos": true,
+ "blockAudios": true,
+ "blockFonts": false,
+ "blockStylesheets": false,
+ "blockImages": false,
+ "acceptHeaders": {
+ "document": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
+ "script": "*/*",
+ "audio": "audio/webm,audio/ogg,audio/wav,audio/*;q=0.9,application/ogg;q=0.7,video/*;q=0.6,*/*;q=0.5",
+ "video": "video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5",
+ "font": "application/font-woff2;q=1.0,application/font-woff;q=0.9,*/*;q=0.8",
+ "stylesheet": "text/css,*/*;q=0.1",
+ "image": "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8"
+ },
+ "saveRawPage": false,
+ "insertMetaCSP": true,
+ "saveToClipboard": false,
+ "addProof": false,
+ "woleetKey": "",
+ "saveToGDrive": false,
+ "saveToDropbox": false,
+ "saveWithWebDAV": false,
+ "webDAVURL": "",
+ "webDAVUser": "",
+ "webDAVPassword": "",
+ "saveToGitHub": false,
+ "githubToken": "",
+ "githubUser": "",
+ "githubRepository": "SingleFile-Archives",
+ "githubBranch": "main",
+ "saveWithCompanion": false,
+ "sharePage": false,
+ "compressHTML": true,
+ "insertTextBody": false,
+ "insertEmbeddedImage": false,
+ "insertEmbeddedScreenshotImage": false,
+ "compressCSS": false,
+ "groupDuplicateStylesheets": false,
+ "moveStylesInHead": false,
+ "loadDeferredImages": true,
+ "loadDeferredImagesMaxIdleTime": 1500,
+ "loadDeferredImagesKeepZoomLevel": false,
+ "loadDeferredImagesDispatchScrollEvent": false,
+ "loadDeferredImagesBeforeFrames": false,
+ "contextMenuEnabled": true,
+ "filenameTemplate": "%if-empty<{page-title}|No title>.{filename-extension}",
+ "filenameMaxLength": "192",
+ "filenameMaxLengthUnit": "bytes",
+ "filenameReplacementCharacter": "_",
+ "replaceEmojisInFilename": false,
+ "saveFilenameTemplateData": false,
+ "shadowEnabled": true,
+ "maxResourceSizeEnabled": true,
+ "maxResourceSize": 10,
+ "networkTimeout": 0,
+ "confirmFilename": false,
+ "filenameConflictAction": "overwrite",
+ "displayInfobar": true,
+ "displayStats": false,
+ "backgroundSave": true,
+ "autoSaveDelay": 1,
+ "autoSaveLoad": false,
+ "autoSaveUnload": false,
+ "autoSaveDiscard": false,
+ "autoSaveRemove": false,
+ "autoSaveLoadOrUnload": true,
+ "autoSaveRepeat": false,
+ "autoSaveRepeatDelay": 10,
+ "autoSaveExternalSave": false,
+ "removeAlternativeFonts": true,
+ "removeAlternativeImages": true,
+ "removeAlternativeMedias": true,
+ "saveCreatedBookmarks": false,
+ "passReferrerOnError": false,
+ "replaceBookmarkURL": true,
+ "allowedBookmarkFolders": [
+ ""
+ ],
+ "ignoredBookmarkFolders": [
+ ""
+ ],
+ "compressContent": false,
+ "createRootDirectory": false,
+ "preventAppendedData": false,
+ "selfExtractingArchive": false,
+ "extractDataFromPage": false,
+ "password": "",
+ "groupDuplicateImages": true,
+ "infobarTemplate": "",
+ "blockMixedContent": true,
+ "saveOriginalURLs": false,
+ "includeInfobar": false,
+ "openInfobar": false,
+ "removeSavedDate": false,
+ "confirmInfobarContent": false,
+ "autoClose": false,
+ "openEditor": false,
+ "openSavedPage": false,
+ "autoOpenEditor": false,
+ "defaultEditorMode": "normal",
+ "applySystemTheme": true,
+ "warnUnsavedPage": true,
+ "displayInfobarInEditor": false,
+ "saveToRestFormApi": false,
+ "saveToRestFormApiUrl": "",
+ "saveToRestFormApiToken": "",
+ "saveToRestFormApiFileFieldName": "",
+ "saveToRestFormApiUrlFieldName": "",
+ "saveToS3": false,
+ "S3Domain": "s3.amazonaws.com",
+ "S3Region": "",
+ "S3Bucket": "",
+ "S3AccessKey": "",
+ "S3SecretKey": "",
+ "loadDeferredImagesBlockCookies": false,
+ "loadDeferredImagesBlockStorage": false,
+ "filenameReplacedCharacters": [
+ "~",
+ "+",
+ "?",
+ "%",
+ "*",
+ ":",
+ "|",
+ "\"",
+ "<",
+ ">",
+ "\\\\",
+ "\u0000-\u001f",
+ ""
+ ],
+ "filenameReplacementCharacters": [
+ "_",
+ "_",
+ "_",
+ "_",
+ "_",
+ "_",
+ "_",
+ "_",
+ "_",
+ "_",
+ "_"
+ ],
+ "tabMenuEnabled": true,
+ "browserActionMenuEnabled": true,
+ "logsEnabled": true,
+ "progressBarEnabled": true,
+ "maxSizeDuplicateImages": 524288,
+ "forceWebAuthFlow": false,
+ "resolveFragmentIdentifierURLs": false,
+ "userScriptEnabled": false,
+ "saveFavicon": true,
+ "includeBOM": false,
+ "insertMetaNoIndex": false,
+ "insertSingleFileComment": true,
+ "blockAlternativeImages": true,
+ "delayBeforeProcessing": 0,
+ "_migratedTemplateFormat": true,
+ "resolveLinks": true,
+ "infobarPositionAbsolute": false,
+ "infobarPositionTop": "16px",
+ "infobarPositionRight": "16px",
+ "infobarPositionBottom": "",
+ "infobarPositionLeft": ""
+ }
+ },
+ "rules": [
+ {
+ "url": "file:",
+ "profile": "__Default_Settings__",
+ "autoSaveProfile": "__Disabled_Settings__"
+ }
+ ],
+ "maxParallelWorkers": 12,
+ "processInForeground": false
+} \ No newline at end of file
diff --git a/misc/bin/unzipall.sh b/misc/bin/unzipall.sh
new file mode 100755
index 0000000..2d654f0
--- /dev/null
+++ b/misc/bin/unzipall.sh
@@ -0,0 +1,8 @@
+#/bin/bash
+
+# unzip all zip/7z files with 7z in pwd
+for f in ./*; do
+ ext=${f##*.}
+ if test "$ext" = zip; then 7z e "$f"; fi;
+ if test "$ext" = 7z; then 7z e "$f"; fi;
+done
diff --git a/misc/bin/zipall.sh b/misc/bin/zipall.sh
new file mode 100755
index 0000000..0a244c2
--- /dev/null
+++ b/misc/bin/zipall.sh
@@ -0,0 +1,9 @@
+#/bin/bash
+
+# zip all non-7z and non-zip files with 7z in pwd and delete the original
+for f in ./*; do
+ ext=${f##*.}
+ if test "$ext" = zip; then continue; fi;
+ if test "$ext" = 7z; then continue; fi;
+ 7z a -sdel "$f.7z" "$f"
+done