Skip to content

Instantly share code, notes, and snippets.

View daanzu's full-sized avatar

David Zurow daanzu

View GitHub Profile
@knyazer
knyazer / add_to_fish_config.fish
Last active January 21, 2025 21:51
Bringing AI to Git commit.
function gcm
# Check if llm is installed, if not, install it
if not type -q llm
echo "'llm' is not installed. Attempting to install it using pip..."
if pip install llm
echo "'llm' installed successfully."
else
echo "Failed to install 'llm'. Please install it manually and try again."
return 1
end
@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() {
@rcland12
rcland12 / yolo_classes.json
Created July 14, 2023 04:08
A list of all 80 YOLO classes and its index in JSON format.
{
"class": {
"0": "person",
"1": "bicycle",
"2": "car",
"3": "motorcycle",
"4": "airplane",
"5": "bus",
"6": "train",
"7": "truck",
@todbot
todbot / udp_recv_code.py
Last active September 15, 2024 22:17
UDP sender and receiver in CircuitPython
# udp_recv_code.py -- receive UDP messages from any receiver, can be another CircuitPython device
# 24 Aug 2022 - @todbot / Tod Kurt
# cribbing from code at https://github.com/adafruit/circuitpython/blob/main/tests/circuitpython-manual/socketpool/datagram/ntp.py
import time, wifi, socketpool
from secrets import secrets
print("Connecting to WiFi...")
wifi.radio.connect(ssid=secrets['ssid'],password=secrets['password'])
print("my IP addr:", wifi.radio.ipv4_address)
pool = socketpool.SocketPool(wifi.radio)
@idelem
idelem / titleUrlMarkdownClip.js
Last active March 5, 2025 13:13 — forked from bradleybossard/titleUrlMarkdownClip.js
Bookmarklet to copy current page title and url in Markdown format to clipboard, like [title](url) - Usual for posting links to resources in README.md files
javascript:(function() {
function copyToClipboard(text) {
if (window.clipboardData && window.clipboardData.setData) {
/*IE specific code path to prevent textarea being shown while dialog is visible.*/
return clipboardData.setData("Text", text);
} else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
var textarea = document.createElement("textarea");
textarea.textContent = text;
-- autosave.lua
--
-- Periodically saves "watch later" data during playback, rather than only saving on quit.
-- This lets you easily recover your position in the case of an ungraceful shutdown of mpv (crash, power failure, etc.).
--
-- You can configure the save period by creating a "lua-settings" directory inside your mpv configuration directory.
-- Inside the "lua-settings" directory, create a file named "autosave.conf".
-- The save period can be set like so:
--
-- save_period=60
@TheDrHax
TheDrHax / autosave.lua
Last active April 5, 2025 20:38 — forked from Hakkin/autosave.lua
MPV script that periodically saves "watch later" data during playback
-- autosave.lua
--
-- Periodically saves "watch later" data during playback, rather than only saving on quit.
-- This lets you easily recover your position in the case of an ungraceful shutdown of mpv (crash, power failure, etc.).
--
-- You can configure the save period by creating a "lua-settings" directory inside your mpv configuration directory.
-- Inside the "lua-settings" directory, create a file named "autosave.conf".
-- The save period can be set like so:
--
-- save_period=60
from __future__ import print_function, unicode_literals
from ctypes import windll
from dragonfly import (ActionBase, Choice, Grammar, IntegerRef, Key,
MappingRule, Mouse, Pause, Repeat)
from dragonfly.actions.keyboard import Keyboard, KeySymbols
KEYBOARD = Keyboard()
from dragonfly import *
import nsformat
dictation_length = [] # for "scratch that" purposes
input_state = None
""" Note: if you pass in the input state into the function using the function action rather than just accessing it
from within the function using the fact that it is in global scope, the input state will not be updated
when you run the dictation command multiple times
To see what I mean note that in contrast to the approach here, the approach taken
at the following link does not update the state after each dictation utterance
------------------
Grammar(chrome): 3 rules (1 exported, 0 imported):
- ChromeRule(chrome) 1571
- Alternative(...) 1570
- Compound('[<click_by_voice_options>] <numbers>') 376
- Sequence(...) 375
- Optional(...) 18
- Choice(..., name='click_by_voice_options') 17
- Compound('click') 2 (+ 1 trivial direct child)
- Compound('copy') 2 (+ 1 trivial direct child)