View figmaScrollToZoom.hs.lua
This file contains 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
-- https://forum.kicad.info/t/zoom-with-scroll-wheel-but-pan-with-trackpad-on-macos/11974 | |
figmaScrollToZoom = hs.eventtap.new({hs.eventtap.event.types.scrollWheel}, function(e) | |
-- Trackpad scroll events are continuous, mouse scroll events are not. | |
if 0 == e:getProperty(hs.eventtap.event.properties.scrollWheelEventIsContinuous) then | |
local front = hs.application.frontmostApplication() | |
if "Figma" == front:name() then | |
-- local title = front:focusedWindow():title() | |
-- if "Eeschema" == title:sub(0, 8) or "Pcbnew" == title:sub(0, 6) then | |
local flags = e:getFlags() |
View set-pdf-thumbnails.sh
This file contains 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
#!/bin/bash | |
# Add thumbnails to images. This works well for document images (like PDFs), | |
# where the top of the image is the most important. | |
for file in "$@"; do | |
# `--cropOffset 0 0` doesn't do anything, so we use a small offset. | |
sips \ | |
-s format png \ | |
--resampleWidth 512 \ | |
--cropOffset 0 0.001 \ |
View flatten-image-masks-in-svg.js
This file contains 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
// 1. Export the file to PDF. | |
// | |
// 2. Convert it to SVG: | |
// | |
// inkscape $file.pdf -o $file.svg --export-text-to-path | |
// | |
// Note: Don't use pdftocairo or pdf2svg; they don't work properly with the next steps. | |
// | |
// 3. Open the SVG file in your browser. | |
// |
View page-summary-overlay.user.js
This file contains 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
// ==UserScript== | |
// @name Summarize Page Text | |
// @namespace https://github.com/szhu | |
// @description Use OpenAI GPT-3 to summarize the text on the page into 3 key points. | |
// @match *://*/* | |
// ==/UserScript== | |
// @ts-strict | |
const API_KEY = "API_KEY"; |
View stickes-hole-window.swift
This file contains 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 AppKit | |
import ApplicationServices | |
import CoreFoundation | |
import Foundation | |
// Helpers | |
// https://github.com/keith/ModMove/blob/main/ModMove/AXValue%2BHelper.swift | |
extension AXValue { | |
func toValue<T>() -> T? { |
View node_modules.sh
This file contains 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
#!/bin/sh | |
# File formatted with shell-format. | |
# | |
# This tool creates a disk image to put node_modules in. This makes it so that | |
# when the disk image is not mounted, it is treated as a single file by | |
# Spotlight and other tools to do expensive tasks on a per-file basis. | |
set -e | |
# Utils |
View gmail-sender-utils.user.js
This file contains 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
// ==UserScript== | |
// @name Gmail Sender Utils | |
// @namespace https://github.com/szhu | |
// @match https://mail.google.com/mail/u/* | |
// @version 1.1 | |
// @author Sean Zhu | |
// ==/UserScript== | |
// | |
// For Chrome, install using the instructions below. | |
// |
View svg-extract-images.js
This file contains 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
for (let image of document.querySelectorAll("image")) { | |
let url = (image.getAttribute("xlink:href")); | |
fetch(url).then(res => res.blob()).then(blob => open(URL.createObjectURL(blob))); | |
} |
View git-autosave
This file contains 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
#!/bin/bash | |
set -e | |
old_stash_count=$(git stash list | wc -l) | |
git stash push --keep-index --include-untracked --quiet | |
if test "$old_stash_count" == "$(git stash list | wc -l)"; then | |
echo "All changes have been committed." | |
exit 0 | |
fi |
View dom-to-tsv.js
This file contains 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
// Example usage: | |
// This grabs the receipt from an order on instacart.com: | |
domToTsv( | |
[`.css-oqluv6`], // selects the table | |
`li[class$=DeliveryItemDetails]`, // selects rows in table | |
[ | |
".css-coqxwd", // selects the name "column" | |
".css-1a4cpf7, .css-1dv9j3w", // selects the price "column" | |
] | |
) |
NewerOlder