lgarron
's scripts
Many scripts can be installed using: https://github.com/lgarron/homebrew-lgarron/
Many scripts are also written in fish
.
Open a Markdown file in either Obsidian (if in a relevant folder) or VSCode.
Restart Quicksilver.
Convert to flac
Convert to .mp3
with high (but not maximum) quality.
Convert to .wav
Commands to run for turning on gaming mode.
Commands to run for turning off gaming mode.
Clone the given URL to ~/Code/git/github.com/[user]/[repo]/
. Useful to combine with chrometab
, or using QS.
Calculate the distance from the current branch (or any branch) to another branch, in terms of # of unique commits on each since the last common ancestor.
Compress any node_modules
in the current or ancestor folders (useful to reduce the number of files on disk for a dormant repo, which can make system backups faster to diff).
Remove git
branches locally and remotely.
Remove git
tags locally and remotely.
Push and update git
tags automatically.
Get the current or previous project version.
Optimise a single file using jpeg-recompress
.
Optimise all .jpg
files in the current folder using jpeg-recompress
.
A script to optimize JPEGs, by Loren Merritt
A script to optimize JPEGs, by Loren Merritt.
Resize an image (padding with transparency if needed).
Resize an image into a square (padding with transparency if needed).
Automatically create resized versions of an icon for web app use cases.
Convert an image into an optimized black-and-white file using this gist by Leland Batey.
Copy a link to the given path (relative to the current working dir, or absolute), creating it if needed.
Open a link to the given path (relative to the current working dir, or absolute) on the Dropbox website in the browser.
Pack argument files into a logs.7z
file. Example: pack-logs *.log
Pack .bmp
or .png
files in a folder. Example: pack-pov cube?????.png
Create a .dmg
out of a folder. Can be as useful as a .zip
file, but allows mounting and editing in macOS without any special tools. Example: dmgify ./path/to/folder
Create a simple HTML folder index for the given input files.
Given either the source or destination of a DCIM
file backed up using sd-card-backup
, reveal the other.
Get thermal pressure on macOS without sudo
ing every time.
Run niceplz
without sudo
ing every time.
Take a macOS screenshot and save it with with a folder and file name based on the current foreground app. (Currently hardcoded to my own Dropbox path.)
Assign an icon file to a file/folder.
Print the number of watts supported by the current charger.
Script to set the nicess of processes based on ~/.config/niceplz/niceplz.json
.
Set the nicess of processes by matching (a substring of) process names. Invokes sudo
if needed.
Set a process to maximum niceness using pnice
.
Enable Touch ID for sudo commands in shells by adding pam_tid.so
to /private/etc/pam.d/sudo
. Useful after every macOS update. Example: touch-id-sudo-config enable
Super simple parallization scripts. Example: map process file1.txt file2.txt
Run kill -9
for any processes using a given port. Example: portkill 8000
Set the remote screen sharing resolution for a given computer automatically. Hardcoded to a 5K monitor and the 16-inch MacBook Pro.
Replace a symlink with its target.
Toggle Retina display scaling. Requires RDM to be installed.
Toggle resolution for screen sharing. Requires RDM to be installed.
Print the current unix time in seconds. Equivalent to date +%s
but easier to remember.
A wrapper for dig
that allows using ~/.config/dig/digrc
(XDG dir convention compatible) instead of .digrc
, with reasonable fidelity.
Encode a video using HEVC for excellent archival quality.
Wraps RX100 AVCHD files into a .mov
that macOS likes.
Timelapse a video by averaging frames.
Install and configure biome
for a JS repo with my legacy defaults.
Roll a dependency to the latest version and add using bun
.
Get the current open Chrome tab.
Calculate the cost of a given npm
module by number of files and disk size, without modifying the current folder.
Roll a dependency to the latest version and install using npm
.
Get the current open Safari tab.
Bundles and runs the given entry file using esbuild
.
Create a .webloc
file for the given URL. Example (using chrometab
in fish
): weblocify (chrometab) bookmark-file.webloc
Use youtube-dl
to get a .flac
file for a URL.
Use youtube-dl
to get a .mp3
file for a URL.