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
# atuin is rust based; no need to cache shell completions
if (( $+commands[atuin] )); then
# not possible to disable up-arrow via a config
source <(atuin init zsh --disable-up-arrow)
source <(atuin gen-completions --shell zsh)
fi
# make sure you execute this *after* asdf or other version managers are loaded
cache_file="${0:A:h}/alias_cache.zsh"
if (( $+commands[just] )); then
if [[ ! -f "$cache_file" || ! $(find "$cache_file" -mtime -15 2>/dev/null) ]]; then
just --completions zsh > "$cache_file"
fi
source "$cache_file"
# make sure you execute this *after* asdf or other version managers are loaded
cache_file="${0:A:h}/alias_cache.zsh"
if (( $+commands[mise] )); then
if [[ ! -f "$cache_file" || ! $(find "$cache_file" -mtime -15 2>/dev/null) ]]; then
mise completion zsh > "$cache_file"
fi
source "$cache_file"
# make sure you execute this *after* asdf or other version managers are loaded
plugin_dir="${0:A:h}"
cache_file="$plugin_dir/_rg"
if (( $+commands[rg] )); then
if [[ ! -f "$cache_file" || ! $(find "$cache_file" -mtime -15 2>/dev/null) ]]; then
rg --generate=complete-zsh > "$cache_file"
fi
# make sure you execute this *after* asdf or other version managers are loaded
cache_file="${0:A:h}/alias_cache.zsh"
if (( $+commands[gh] )); then
if [[ ! -f "$cache_file" || ! $(find "$cache_file" -mtime -15 2>/dev/null) ]]; then
gh copilot alias -- zsh > "$cache_file"
gh completion --shell zsh >> "$cache_file"
fi
# make sure you execute this *after* asdf or other version managers are loaded
if (( $+commands[mcfly-fzf] )) && (( $+commands[fzf] )) && (( $+commands[mcfly] )); then
eval "$(mcfly init zsh)"
eval "$(mcfly-fzf init zsh)"
fi
if (( $+commands[az] )); then
autoload -U +X bashcompinit && bashcompinit
source $(brew --prefix)/etc/bash_completion.d/az
fi
plugin_dir="${0:A:h}"
cache_file="$plugin_dir/_ov"
if (( $+commands[ov] )); then
if [[ ! -f "$cache_file" || ! $(/usr/bin/find "$cache_file" -mtime -15 2>/dev/null) ]]; then
ov --completion zsh > "$cache_file"
fi
fpath+=$plugin_dir
@iloveitaly
iloveitaly / openai_log_to_file.py
Created March 25, 2024 21:49
funnel all the OpenAI logs to a specific file.
def setup():
"""
Config below is subject to change
https://stackoverflow.com/questions/76256249/logging-in-the-open-ai-python-library/78214464#78214464
https://github.com/openai/openai-python/blob/de7c0e2d9375d042a42e3db6c17e5af9a5701a99/src/openai/_utils/_logs.py#L16
"""
openai_log_path = taxdocs.root / "openai.log"
openai_file_handler = logging.FileHandler(openai_log_path)