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 \ |
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. | |
// |
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? { |
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 |
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))); | |
} |
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
# Tell Spotlight to ignore all node_modules directories. | |
# Run this from the home directory. | |
# Pieced together from: | |
# - https://github.com/yarnpkg/yarn/issues/6453#issuecomment-498110933 | |
# - https://stackoverflow.com/a/4210072/782045 | |
# - https://superuser.com/a/151427/110699 | |
# - https://apple.stackexchange.com/a/258791/31413 | |
# - https://unix.stackexchange.com/a/24563/64762 | |
# This does a dry run; remove `echo` to do actually do it. |
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 |
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
// pbpaste | deno run --reload https://gist.githubusercontent.com/szhu/54a314fa055b4e6d07e1446ca9f3ea8a/raw/convertPropTypesToTs.ts | pbcopy | |
interface ToStringAble { | |
toString(): string; | |
} | |
type TypeSpecToString = (this: TypeSpec) => string; | |
interface TypeSpec { | |
name: string; |
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 your desktop background to your screen saver. | |
# Install and activate with: | |
# curl -fsSL https://git.io/vMgM9 | bash | |
# | |
# The screen saver is visible only on desktops created before the screen saver | |
# was started. If you create a desktop and wish to see the screen saver on it | |
# immediately, just do: | |
# open -a ScreenSaverEngine | |
# to bring it in front of the default desktop background. You can also add |
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
{ | |
let clientAppState = JSON.parse($("#client-app-state").text.replace(/&q;/g, '"')) | |
let { HttpState } = clientAppState | |
let route = Object.keys(HttpState)[0] | |
HttpState[route].data.properties.identifier.uuid | |
} |