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
| ;;; copy-markdown-paste-to-slack.el --- Rich copy Markdown for Slack -*- lexical-binding: t; -*- | |
| (defun lmoneda/slack--copy-rich-and-plain-to-clipboard (plain-text rtf-text) | |
| "Copy PLAIN-TEXT and RTF-TEXT to macOS clipboard as plain+rich flavors." | |
| (unless (executable-find "osascript") | |
| (user-error "osascript not found")) | |
| (let* ((tmp-text-file (make-temp-file "markdown-slack-plain-" nil ".txt")) | |
| (tmp-rtf-file (make-temp-file "markdown-slack-rich-" nil ".rtf")) | |
| (jxa-script | |
| "ObjC.import(\"Foundation\"); ObjC.import(\"AppKit\"); function run(argv){ const plainPath=argv[0]; const rtfPath=argv[1]; const enc=$.NSUTF8StringEncoding; const plain=$.NSString.stringWithContentsOfFileEncodingError($(plainPath), enc, null); const rtfStr=$.NSString.stringWithContentsOfFileEncodingError($(rtfPath), enc, null); const pb=$.NSPasteboard.generalPasteboard; pb.clearContents; const ok1=pb.setStringForType(plain, $.NSPasteboardTypeString); const rtfData=rtfStr.dataUsingEncoding(enc); const ok2=p |
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
| ;; Visually hide [[id:UUID][ and ]] leaving only the description | |
| (defun my/agent-shell-setup-org-roam-links () | |
| (require 'org) ;; for org-link face | |
| (font-lock-add-keywords | |
| nil | |
| '(("\\(\\[\\[id:[A-Za-z0-9-]+\\]\\[\\)\\([^]]+\\)\\(\\]\\]\\)" | |
| ;; hide prefix and suffix | |
| (1 (prog1 nil | |
| (compose-region (match-beginning 1) (match-end 1) ""))) | |
| (3 (prog1 nil |
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
| ;;; my-smudge-lyrics.el --- Show LRCLIB lyrics for current Smudge track -*- lexical-binding: t; -*- | |
| ;; Smudge → LRCLIB (async) → read-only lyrics buffer | |
| ;;; Commentary: | |
| ;; - M-x my-smudge-lyrics-popup: fetch lyrics for current track and show them. | |
| ;; - Optional: enable `my-smudge-lyrics-auto-popup` to auto-fetch on track change. | |
| ;; | |
| ;; Requirements: | |
| ;; - Smudge (https://github.com/danielfm/smudge) |
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
| import json | |
| import urllib.parse | |
| import spacy | |
| import requests | |
| import re | |
| from http.server import BaseHTTPRequestHandler, HTTPServer | |
| from multi_language_utils import is_en_text, translate_to_english, load_language_detection_model | |
| from urllib.parse import parse_qs, urlparse |
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
| ;; Blogging | |
| ;; The following function helps me to write in a single file in org-roam to produce my personal blog posts. | |
| ;; It avoids copying and pasting to the markdown file for jekyll. | |
| (defun lgm/publish-org-roam-to-jekyll-html (github-repo-dir output-dir branch) | |
| "Export current Org Roam file to Jekyll-compatible HTML5 with YAML front matter. | |
| GITHUB-REPO-DIR: Path to your GitHub Pages repository. | |
| OUTPUT-DIR: Directory inside the repository where the HTML file will be placed. | |
| BRANCH: Branch to which changes should be committed (e.g., 'master')." |
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
| ;; Textual topography | |
| (defun textual-topography () | |
| "Prompt for domain, characteristic/anti-characteristic pair, and selected text. | |
| Save selected text to a file and call a Python script with the arguments." | |
| (interactive) | |
| ;; Define the domains and their associated characteristic/anti-characteristic pairs | |
| (setq domain-characteristics | |
| '(("Mood" . (("Happy" . "Unhappy") ("Calm" . "Agitated") ("Optimistic" . "Pessimist"))) | |
| ("Style" . (("Complex" . "Simple"))) |
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
| import numpy as np | |
| import pandas as pd | |
| import itertools | |
| import seaborn as sns | |
| import matplotlib.pyplot as plt | |
| import openai | |
| import os | |
| import time | |
| from dotenv import load_dotenv |
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
| from datetime import date | |
| today = date.today() | |
| # Minor modification from langchain library example | |
| PROMPT_PRE = """ | |
| My name is Luis Moneda. You are my personal assistant. Given the following extracted parts of long documents from my personal notes and a question, create a final answer with references ("SOURCES"). | |
| The content of the document will be preceeded by the title hierarchy it was taken from inside brackets, which you should use to get context about it. | |
| If you don't know the answer, just say that you don't know. Don't try to make up an answer. | |
| ALWAYS return a "SOURCES" part in your answer that only contains numbers. Today is {}. |
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
| import os | |
| import re | |
| import numpy as np | |
| import pandas as pd | |
| import torch | |
| import warnings | |
| from adjustText import adjust_text | |
| from sentence_transformers import SentenceTransformer | |
| from sklearn.manifold import TSNE |
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
| (defun my-org-make-link () | |
| "Turn selected text into an Org mode link by replacing the selected | |
| text with a link that uses the selected text as the link description | |
| and the clipboard contents as the link URL." | |
| (interactive) | |
| (let ((link-description (if (use-region-p) | |
| (buffer-substring-no-properties (region-beginning) (region-end)) | |
| (read-string "Link description: "))) | |
| (clipboard-contents (current-kill 0))) | |
| (delete-region (region-beginning) (region-end)) |
NewerOlder