Skip to content

Instantly share code, notes, and snippets.

View kasperschnack's full-sized avatar

kasperschnack

  • 07:57 (UTC +02:00)
View GitHub Profile
@kasperschnack
kasperschnack / git-smart-commit.py
Created March 25, 2025 07:03
Generate Conventional Commits using AI from Git diffs. Stages changes, runs pre-commit, suggests a commit message via OpenAI, and optionally opens editor or pushes. Make executable as git smart-commit.
import os
import sys
import asyncio
import subprocess
import argparse
from openai import AsyncOpenAI
client = AsyncOpenAI()
def run_command(command, check=True):
@kasperschnack
kasperschnack / git-show-commits.py
Created March 24, 2025 23:08
Show recent Git commits with full diffs, metadata, and changed files. Outputs colorized terminal view and copies plain text to clipboard.
import sys
import subprocess
import argparse
from datetime import datetime
import pyperclip # You might need to: pip install pyperclip
def run_git_command(command):
try:
return subprocess.check_output(command, shell=True).decode('utf-8')
except subprocess.CalledProcessError as e:
@kasperschnack
kasperschnack / mark_n_move.py
Last active November 20, 2018 14:17
Python script for manually tagging images into binary classes
#!/usr/bin/python
import argparse
import os
import shutil
from os.path import isfile, join
import cv2
import numpy as np