Skip to content

Instantly share code, notes, and snippets.

@firexcy
firexcy / StandardKeyBinding.dict.json
Created July 20, 2023 11:23
Content of the Cocoa text system’s standard keybindings (as of macOS Ventura 13.4.1); converted from the original binary format to the json format with non-priting & PUA chars escaped
{
"\u0003": "insertNewline:",
"\b": "deleteBackward:",
"\t": "insertTab:",
"\n": "insertNewline:",
"\r": "insertNewline:",
"\u0019": "insertBacktab:",
"\u001b": "cancelOperation:",
"$\uf700": "moveUpAndModifySelection:",
"$\uf701": "moveDownAndModifySelection:",
@firexcy
firexcy / gridify.sh
Last active April 18, 2023 08:17
Split an image evenly with optional margins and colored background to create an IG-style grid layout
#!/bin/bash
file="$1"
background="white"
margin="0"
shift
while [ "$#" -gt 0 ]; do
case "$1" in
-background)
@firexcy
firexcy / pwgen.sh
Created March 27, 2023 23:21
pwgen.sh
#!/bin/bash
main() {
part1=$(pick)
part2=$(pick)
part3=$(pick)
part1a=$(echo "$part1" | tr 'aeiost' '431057' | tr '[:lower:]' '[:upper:]')
part2a=$(echo "$part2" | tr 'aceist' '@(&!$+')
echo "$part1a-$part2a-$part3"
echo "$part1 $part2 $part3"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadDisplayName</key>
<string>edge-nobb</string>
<key>PayloadIdentifier</key>
<string>com.example.edge-nobb</string>
<key>PayloadType</key>
<string>Configuration</string>
@firexcy
firexcy / whisper.cpp.sh
Created January 28, 2023 12:04
Transcribe recordings with the C++ port of OpenAI Whisper
# Clone the project
git clone https://github.com/ggerganov/whisper.cpp && cd whisper.cpp
# Download at least one model, which may be "tiny", "base", "small", "medium",
# "large", etc. Usually "medium" is sufficient for recordings in Chinese.
bash ./models/download-ggml-model.sh medium
# Compile the program
make
@firexcy
firexcy / readme.md
Last active April 23, 2024 09:06
DIY a Rewind.ai

This Gist provides a solution to periodically capture screenshots of your Mac, and create therefrom a searchable PDF archive so that you can always get an answer to the “what, when, and where” questions about your usages.

To use these scripts:

  1. Download the shell script rewind, then:
    1. put it under ~/bin (or other fixed path you prefer);
    2. execute
set gutter to 10
set sidebarWidth to 330
set wcMinHeight to 500
set wcMinWidthSansSB to 500
tell application "Finder"
set scrRes to bounds of window of desktop
end tell
tell application "WeChat"
set resX to item 3 of scrRes
set resY to item 4 of scrRes
-- Front matters
set urlList to {}
set listTitle to "# Vivaldi URL List | " & ((current date) as string)
-- Get tabs
tell application "Vivaldi"
activate
set windowList to window 1
repeat with w in windowList
try