Skip to content

Instantly share code, notes, and snippets.

@vpnry
vpnry / a-wotd-custom-word-list.md
Created October 20, 2025 07:20 — forked from jsomers/a-wotd-custom-word-list.md
How to use a custom word list with OS X's "Word of the Day" screensaver

OS X's "Word of the Day" screensaver is a great way to passively learn words:

But I've always thought that its word list kind of stunk—it was full of obscure words that I could never really see myself using. I'd prefer something like Norman Schur's 1000 Most Important Words. What if you could plug your own word list into the screensaver?

On a rather obscure comment thread, someone explained where you might find the word list that Apple uses to power the screensaver. It is at /System/Library/Graphics/Quartz\ Composer\ Plug-Ins/WOTD.plugin/Contents/Resources/NOAD_wotd_list.txt. The file looks like this:

m_en_us1282510	quinsy
@vpnry
vpnry / translate_prompt.txt
Last active February 24, 2025 03:34
Prompt and script to prepare chunk for AI translation
Your role is a professional translator specializing in Theravada Buddhist texts, with expertise in translating from Sinhala into English. Your translations prioritize accuracy in conveying both the literal meaning and the deeper spiritual context of the original text. You strive to maintain the nuances and technical terminology specific to Theravada Buddhism while making the text accessible to English readers.
Your translation will be used in a book print. When translating, adhere to these guidelines:
- 1. Provide only the accurate translation of the input text without additional explanations or commentary.
- 2. Preserve important Sinhala Pali term in Roman script or other terms in transliteration when an exact English equivalent doesn't exist.
- 3. Maintain the tone and style of the original text as much as possible.
- 4. Maintain the original markdown format and preserve paragraph breaks and segments
- 5. Use consistent terminology throughout the translation, especially for key Buddhist concepts.
- 6. If
@vpnry
vpnry / rename_url_encodes.py
Created February 10, 2024 09:22
To rename files according to its parent dir name. Directory names are URL encoded
# rename files according to its parent dir name
# directory names are URL encoded
# generated with CHATGPT (tested)
import os
from urllib.parse import unquote
# Function to decode URL encoded folder names
def decode_folder_name(folder_name):
return unquote(folder_name)
@vpnry
vpnry / mms_text_to_speech.py
Created May 25, 2023 01:42
MMS speech fairseq TTS app
'''
Run with
PYTHONPATH=$PYTHONPATH:./fairseq/vits python3 app.py --model_dir LANG --file_path text.txt
LANG is your model language
'''
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
@vpnry
vpnry / nodejs_split_smaller_dict.js
Created April 1, 2023 18:38
nodejs split dictionary
const fs = require("fs");
const PARTS = 10;
// Load the original dictionary from a file
const DICTOBJ = require("./DICTOBJ.js");
// Split the keys into 4 roughly equal PARTS
const keys = Object.keys(DICTOBJ);
const chunkSize = Math.ceil(keys.length / PARTS);
const chunks = [];
@vpnry
vpnry / phpwin_browser.php
Created April 1, 2023 18:36
phpwin iPadOS browser
<?php
// Generated with the support of ChatGPT
// This script is to be used with phpwin app on iPadOS
// To add dictionary funtions on the HTML web page
// Check if the user has submitted a URL
if(isset($_POST['url'])) {
// Retrieve the URL from the form input
$url = $_POST['url'];
@vpnry
vpnry / getClickedWord.js
Created March 26, 2023 17:14
JavaScript algorithm/snippet to split concatenated words to word again according to dictionary input, get clicked word functions
function getClickedWord(e) {
/** Generated with Bing AI ChatGPT */
var defiEl = document.getElementById("dictionary-res");
var tocDivBox = document.getElementById("tocDivBox");
/** Not getting words on these elements */
if (
!defiEl.contains(e.target) &&
!tocDivBox.contains(e.target) &&
@vpnry
vpnry / nodejs_wrap_word_with_tag.js
Last active March 26, 2023 17:06
Nodejs script that wraps words in HTML file with a specified tag, Pyhon script to split file HTML file into smaller parts
/**
* NodeJS script that wrap all words into tags.
* npm install cheerio
* Generated with the help of ChatGPT :)
**/
const fs = require("fs");
const path = require("path");
const cheerio = require("cheerio");
@vpnry
vpnry / myenmy_template_2023_script.users.js
Last active April 2, 2023 14:58
Myanmar Popup Dictionary Userscript
// ==UserScript==
// @name MYENMY-Dictionary
// @namespace https://gist.github.com/vpnry/f4d16b7ab71f30f4a6f5d4a3d66bd5da
// @version 2023.04.02.2129
// @description MEM-Dictionary For Tampermonkey UserScript
// @author uPNRY with the assistance of ChatGPT
// @match http://*/*
// @match https://*/*
// @exclude http://google.com/*
// @exclude https://google.com/*
@vpnry
vpnry / tab_to_sqlite.py
Created March 13, 2023 11:24
Stardict tabfile into Sqlite3 with python
import os
import sqlite3
def stardict_tab_to_sqlite3(tab_file: str) -> None:
# Generated with the support of ChatGPT OpenAI
# 13 Mar 2023
# Check if the dictionary.db file exists and delete it if it does
if os.path.exists('dictionary.db'):