Skip to content

Instantly share code, notes, and snippets.

View raphaeltraviss's full-sized avatar

Raphael Traviss raphaeltraviss

View GitHub Profile
@raphaeltraviss
raphaeltraviss / pbresize
Created June 28, 2023 16:00
macOS command to resize a hi-res image in the pasteboard to a normal size image, for pasting into applications that don't handle HPDI
#!/bin/bash
# Usage:
# copy image to pasteboard via CMD-C
# then call pbresize on command line
# or call with a custom scale e.g. pbresize 0.7
SCALE_FACTOR=${1:-0.5}
pngpaste /tmp/ss.png
@raphaeltraviss
raphaeltraviss / gist:8923e568e3db1a3dc6afe370c8f22aa1
Created October 24, 2023 15:30
Hammerspoon Four Sides Tiling
hs.hotkey.bind({"ctrl", "shift", "cmd"}, "Left", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = max.x
f.y = max.y
f.w = max.w / 2
f.h = max.h