Skip to content

Instantly share code, notes, and snippets.

@allanrbo
allanrbo / chatgpt.py
Created June 19, 2023 07:08
ChatGPT from your command line, without any library dependencies (API key required)
#!/usr/bin/python3
# Quick and dirty ChatGPT from your command line, without any library dependencies (API key required)
# End your input with a line consisting of just ---
# Stop generating with ctrl-c
from urllib.request import Request, urlopen
import json
messages = []
@karpathy
karpathy / add_to_zshrc.sh
Created August 25, 2024 20:43
Git Commit Message AI
# -----------------------------------------------------------------------------
# AI-powered Git Commit Function
# Copy paste this gist into your ~/.bashrc or ~/.zshrc to gain the `gcm` command. It:
# 1) gets the current staged changed diff
# 2) sends them to an LLM to write the git commit message
# 3) allows you to easily accept, edit, regenerate, cancel
# But - just read and edit the code however you like
# the `llm` CLI util is awesome, can get it here: https://llm.datasette.io/en/stable/
gcm() {