Skip to content

Instantly share code, notes, and snippets.

@thomp
thomp / standalone_html.py
Created December 4, 2019 22:34 — forked from pansapiens/standalone_html.py
Convert HTML to a self contained file with inline Base64 encoded PNG images
#!/usr/bin/env python
# A simple script to suck up HTML, convert any images to inline Base64
# encoded format and write out the converted file.
#
# Usage: python standalone_html.py <input_file.html> <output_file.html>
#
# TODO: Consider MHTML format: https://en.wikipedia.org/wiki/MHTML
import os
from bs4 import BeautifulSoup
@thomp
thomp / dtk-11.el
Created February 24, 2020 18:23
fn to query diatheke and return "parsed" diatheke output
;; variant of dtk-bible--insert-using-diatheke which returns parsed diatheke output
(defun dtk-bible--parse-diatheke (book chapter-verse &optional module diatheke-output-format)
"Insert content specified by BOOK and CHAPTER-VERSE into the current buffer. CHAPTER-VERSE is a string of the form CC:VV (chapter number and verse number separated by the colon character).
Optional argument MODULE specifies the module to use."
(unless diatheke-output-format
(setq diatheke-output-format :plain))
(let ((module (or module dtk-module)))
(with-temp-buffer
(dtk-diatheke (list book chapter-verse) module t diatheke-output-format nil)
(cond ((dtk-check-for-text-obesity)
@thomp
thomp / dat-diary-idle-timer.lisp
Created March 31, 2020 20:15
run emacs diary if idle and we're on a new day
(defvar dat-diary-idle-timer
;; day of week
(let ((dat-ran-diary-on-day -1)
(idle-sec 600))
(run-with-idle-timer
idle-sec
t
#'(lambda ()
;; check if we've run diary yet today
(let ((day-number (calendar-day-of-week (calendar-current-date)))))
@thomp
thomp / gist:e85ffb7329b1ccf409c6f4ee8d405384
Last active February 9, 2023 14:41
youtube styling - block suggestions, previews, etc.
/*
the main page
*/
ytd-browse.style-scope {display: none;}
ytd-browse.ytd-page-manager {display: none;}
/*
single video page
*/
@thomp
thomp / latex_header-examples.md
Created January 19, 2021 22:23
org LaTeX_HEADER examples

Example of LaTeX_header for org

Misc. examples

#+LaTeX_HEADER: \usepackage{parskip} \usepackage{nopageno} \usepackage{tabularx}

#+LaTeX_HEADER: \usepackage[margin=1.5cm,portrait,letterpaper]{geometry} \newenvironment{identity} {\endgroup\ignorespaces} {\begingroup\def\@currenvir{identity}\ignorespacesafterend}
/* car and driver; road and track */
img.i-amphtml-replaced-content {
display:none
}
div.gpt-adslot {
display:none
}
div.content-ads {
@thomp
thomp / dired-file-url.el
Created February 8, 2022 22:15
Grab file URL corresponding to file at point in Dired
(defun dat-url-of-dired-file ()
"Add to the kill ring the URL for tthe file named at the current Dired point."
(interactive)
(let ((tem (dired-get-filename t t)))
(if tem
; (message "file: %s"
(kill-new
(concatenate 'string "file://"
(expand-file-name tem)))
(error "No file on this line"))))
@thomp
thomp / org-latex-header--2022-09.org
Last active May 25, 2023 16:04
Emacs org-mode LaTeX boilerplate

@thomp
thomp / ascii-man-page.txt
Created October 10, 2022 03:28
ASCII man page
ASCII(7) Linux Programmer's Manual ASCII(7)
NAME
ascii - ASCII character set encoded in octal, decimal,
and hexadecimal
DESCRIPTION
ASCII is the American Standard Code for Information In‐
terchange. It is a 7-bit code. Many 8-bit codes (e.g.,
ISO 8859-1) contain ASCII as their lower half. The in‐
@thomp
thomp / ts-sandbox.el
Last active August 17, 2023 19:54
transient-el-sandbox
;; https://gist.github.com/thomp/ff0fb98d4239af4e3f26a7b0cc64f4b6
(require 'transient)
;; simple transient
(transient-define-prefix tsc-hello ()
"Prefix that is minimal and uses an anonymous command suffix."
;; Binding suffixes with the ("key" "description" suffix-or-command) form within a group is extremely common.
[("s" "call suffix"
(lambda ()
(interactive)