Skip to content

Instantly share code, notes, and snippets.

View iloveitaly's full-sized avatar

Michael Bianco iloveitaly

View GitHub Profile
# make sure you execute this *after* asdf or other version managers are loaded
# bun completions are strange: running `bun completions` installs ~/.bun/_bun and does not output the completion source code
# this is a hack until bun fixes their completion setup https://github.com/oven-sh/bun/issues/1272
if (( $+commands[bun] )); then
[ -s ~/.bun/_bun ] || bun completions
# cannot source directly, must add fpath to completions
fpath+=~/.bun/
# make sure you execute this *after* asdf or other version managers are loaded
# the default docker completion is not as advanced as this one, you'll want to remove it:
# rm $(brew --prefix)/share/zsh/site-functions/_docker
# https://github.com/docker/compose/issues/8550
if (( $+commands[docker] )); then
eval "$(docker completion zsh)"
fi
@iloveitaly
iloveitaly / categorize.py
Created February 9, 2024 00:10
Example of how to categorize emails using openai
import click
import sqlite_utils
import json
import logging
SERVICE = "openai"
PREFIX = ""
logger = logging.getLogger(__name__)
@iloveitaly
iloveitaly / logout_twitter.applescript
Created November 25, 2023 00:37
Logout of Twitter with an Applescript. Fight distraction.
tell application "Safari"
activate
open location "https://twitter.com/logout"
end tell
tell application "System Events"
tell process "Safari"
delay 0.5
click button "Log out" of group 1 of group 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window 1
end tell
# make sure you execute this *after* asdf or other version managers are loaded
if (( $+commands[pack] )); then
source "$(pack completion --shell zsh)"
fi
@iloveitaly
iloveitaly / 1password.zsh
Last active October 31, 2023 14:43
a zsh plug-in to load the one password shell completions and plugin environment variables
# make sure you execute this *after* asdf or other version managers are loaded
if (( $+commands[op] )); then
eval "$(op completion zsh)"
compdef _op op
# load plugins configuration
if [[ -f ~/.config/op/plugins.sh ]]; then
source ~/.config/op/plugins.sh
fi
fi
# make sure you execute this *after* asdf or other version managers are loaded
if (( $+commands[orbctl] )); then
eval "$(orbctl completion zsh)"
compdef _orb orbctl
compdef _orb orb
fi
@iloveitaly
iloveitaly / github-copilot-cli.zsh
Last active August 30, 2023 14:26
zinit plugin for github-copilot-cli
# make sure you execute this *after* asdf or other version managers are loaded
if (( $+commands[github-copilot-cli] )); then
eval "$(github-copilot-cli alias -- "$0")"
fi
@iloveitaly
iloveitaly / hide_and_quit_apps.sh
Created January 6, 2023 23:09
Hide and quit macOS applications in bash/zsh using AppleScript via osascript
function quit_apps() {
for app in $@; do
echo "Quitting $app..."
osascript -e "with timeout of 30 seconds
quit app \"$app\"
end timeout"
if [ $? -ne 0 ]; then
# if the application did not quit on it's own, let's force it!
@iloveitaly
iloveitaly / fidelity_charitable_export.js
Created July 23, 2022 21:53
Download all PDFs for contributions in fidelity charitable by copy & pasting this into your browser
$x("//a[contains(@href, \"fc-services/api/v1/document/download\")]").forEach(el => { el.download = el.text.replace("(PDF)", "").replace("/", "-") + ".pdf"; var e = document.createEvent('MouseEvents'); e.initEvent('click' ,true ,true); el.dispatchEvent(e);})