Skip to content

Instantly share code, notes, and snippets.

View smeech's full-sized avatar

Stephen Meech smeech

View GitHub Profile
@smeech
smeech / portuguese.yml
Last active August 11, 2025 14:14
[Accented Portuguese words] List of commonly accented Portuguese words #espanso
- trigger: a
replace: à
word: true
propagate_case: true
- trigger: acao
replace: ação
word: true
propagate_case: true
- trigger: acucar
replace: açúcar
@smeech
smeech / decrypt.yml
Last active August 8, 2025 18:50
[Encrypted expansion] A working Espanso trigger that securely decrypts a string (such as an address) using a password prompt, and expands it into your target app. First encrypt your address (once only) and store it securely: `echo "123 Fake Street, Faketown, FK1 2AB" | gpg -c -o ~/.secrets/homeaddr.gpg` ensuring the target directory exists first…
# First encrypt your address (once only) and store it securely:
# `echo "123 Fake Street, Faketown, FK1 2AB" | gpg -c -o ~/.secrets/homeaddr.gpg`
# ensuring the target directory exists first.
matches:
- trigger: ":homeaddr"
replace: "{{address}}"
vars:
- name: address
type: script
@smeech
smeech / Link_to_icon_file
Last active July 16, 2025 11:08
[Icon file] Various sizes, no background, useful for dark themes #espanso
@smeech
smeech / My_data.txt
Last active June 29, 2025 16:55
[Interpreter comparisons] A ChatGPT-generated script to compare the startup times of several interpreters in order to estimate the likely delays when scripts are used in Espanso triggers.. #python #ruby #pwsh #node #bash #espanso #perl #php #sh
Measuring average interpreter startup time over 10 runs...
PowerShell (pwsh) : 0.3438 seconds (avg)
Ruby : 0.0778 seconds (avg)
Node.js : 0.0910 seconds (avg)
Bash : 0.0015 seconds (avg)
sh : 0.0009 seconds (avg)
Python3 : 0.0255 seconds (avg)
Perl : 0.0021 seconds (avg)
@smeech
smeech / fractions.yml
Last active July 19, 2025 13:50
[Fractions] The Espanso package `espanso-fractions` I use routinely, produces the eighteen single character expansions of small fractions. I thought I'd play with a solution for longer fractions using super- and sub-script characters, and came up with the following, which can be triggered by e.g. `:1234/4567 `. #espanso #python #html
- regex: :(?P<before>\d+)/(?P<after>\d+)(?P<end>\s)
replace: "{{output}}{{end}}"
vars:
- name: output
type: script
params:
args:
- python
- -c
- |
@smeech
smeech / multiple_choice.yml
Created June 18, 2025 15:40
[Implement multiple possible returns for a choice form variable] A minimal script workaround to Espanso's inability to return a variable number of choices. #espanso #python
# Via https://chatgpt.com/share/6852dd0d-dcd4-8012-849f-623787d8408a
# In response to https://github.com/espanso/espanso/issues/2360
- trigger: ":checklist"
replace: "{{output}}"
vars:
- name: output
type: script
params:
args:
@smeech
smeech / currency.yml
Last active June 26, 2025 12:20
[Currency conversion] Responds to e.g. ":10gbp/usd" to convert GBP to USD, can handle decimals, and any currency codes listed in the website below. #espanso #bash #python
- regex: :(?P<amount>\d+(?:\.\d+)?)(?P<src>\w{3})/(?P<dst>\w{3})
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: |
dst_uc=$(echo "{{dst}}" | tr '[:lower:]' '[:upper:]')
rate=$(curl -s "https://open.er-api.com/v6/latest/{{src}}" | jq -r ".rates.$dst_uc")
if [ "$rate" = "null" ] || [ -z "$rate" ]; then
@smeech
smeech / date_format.yml
Created May 21, 2025 12:29
[Date formats] Choice or list box to select today's date in different formats #espanso
- trigger: :date
replace: "{{Output.Date}}"
vars:
- {name: Day, type: date, params: {format: '%d'}}
- {name: Month, type: date, params: {format: '%m'}}
- {name: Year2, type: date, params: {format: '%y'}}
- {name: Year4, type: date, params: {format: '%Y'}}
- {name: Another, type: date, params: {format: '%A, %B %d, %Y'}}
- name: Output
type: form
@smeech
smeech / tmux-pi
Last active May 12, 2025 10:10
[tmux-pi] Four-pane tmux to show chrono and filtered processing for two Piholes. Requires tmux and access to two Pi via ssh keys. Works well in a TTY session. #pihole #tmux #bash
#!/bin/bash
# Requires tmux and access to two Pi via ssh keys
# chmod +x tmux-pi to make executable
SESSION=$USER
tmux new-session -d -s $SESSION
# Setup a window for monitoring pi & dietpi
@smeech
smeech / heredoc.yml
Last active August 18, 2025 14:17
[HereDoc] Capture clipboard content, preserving quote characters contained, by using the Here-Document method #espanso #bash #sed
# Capture and process clipboard content, preserving quote characters contained,
# by using the Here-Document method.
- trigger: ":dwq"
replace: "{{MyShell}}"
vars:
- name: Clipb
type: clipboard
- name: MyShell
type: shell