Skip to content

Instantly share code, notes, and snippets.

View ramiroaraujo's full-sized avatar

Ramiro Araujo ramiroaraujo

View GitHub Profile
// Name: convert selected images
import "@johnlindquist/kit";
// Grab selected files
const files = (await getSelectedFile()).split("\n");
// Set up whitelist of formats
const supportedFormats = [".heic", ".png", ".gif", ".webp", ".jpg", ".jpeg"];
// Name: Merge / Split Alfred clipboard
// Description: Merge or split clipboard content using Alfred app's clipboard
import "@johnlindquist/kit"
const Database = await npm("better-sqlite3");
const databasePath = home('Library/Application Support/Alfred/Databases/clipboard.alfdb')
if (!await pathExists(databasePath)) {
notify("Alfred clipboard database not found" )
exit()
// Name: Type Clipboard
// Description: Get the content of the clipboard and "keystroke" it without pasting
// Shortcut: ctrl+cmd+alt+shift+v
import "@johnlindquist/kit"
const clipboardText = await clipboard.readText()
if (clipboardText.length > 1000) {
await notify("Clipboard content is too long")
// Name: Open in WhatsApp
import "@johnlindquist/kit"
//get the text from the clipboard
let text = await clipboard.readText();
//normalize the text
text = text.replace(/[-() ]/g, "");
// Name: convert selected images
import "@johnlindquist/kit";
// Grab selected files
const files = (await getSelectedFile()).split("\n");
// Set up whitelist of formats
const supportedFormats = [".heic", ".png", ".gif", ".webp", ".jpg", ".jpeg"];
// Name: Open URL in clipboard
import "@johnlindquist/kit"
//get the clipboard
let text = await clipboard.readText();
//get the first URL in the clipboard, if any
let url = text.match(/(https?:\/\/[^\s]+)/);
// Name: Emoji Search
// Description: Search and copy emoji to clipboard using SQLite database
import "@johnlindquist/kit"
const Database = await npm("better-sqlite3")
const databaseFile = projectPath("db", "emoji-search-emojilib.db")
const emojilibURL = "https://raw.githubusercontent.com/muan/emojilib/main/dist/emoji-en-US.json"
// Name: Text Manipulation
// Description: Transform clipboard text based on user-selected options
import "@johnlindquist/kit"
let transformations = {
upperCase: text => text.toUpperCase(),
lowerCase: text => text.toLowerCase(),
capitalize: text => text.split('\n').map(line => line.split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ')).join('\n'),
decodeUrl: text => text.split('\n').map(line => decodeURIComponent(line)).join('\n'),
// Name: OCR
// Description: Capture a screenshot and recognize the text using tesseract.js
import "@johnlindquist/kit";
//both win and linux implementations were created by chatgpt (gpt4), without _any_ tests!! 😅
const captureScreenshot = async () => {
const tmpFile = `/tmp/screenshot-${Date.now()}.png`;
if (isMac) {