Skip to content

Instantly share code, notes, and snippets.

View brettschneider's full-sized avatar

Steve Brettschneider brettschneider

View GitHub Profile
@brettschneider
brettschneider / command_io.py
Created January 8, 2025 17:02
Input/output from Bentley
"""Input/output from the from/to the user"""
import sys
from abc import ABC, abstractmethod
from io import BytesIO
import speech_recognition
from gtts import gTTS
from pyaudio import PyAudio
from pydub import AudioSegment
@brettschneider
brettschneider / ollama.vim
Last active December 5, 2024 00:16
Ollama Vim Plugin
" Ollama Plugin: Send selected text or the whole buffer to Ollama
" Escape the input
function! EscapeSingleQuotes(input)
" Escape single quotes for safe use in shell commands
return substitute(a:input, "'", "'\"'\"'", "g")
endfunction
" Ensure the Command-Result (CR) window exists
function! EnsureCRWindow()
@brettschneider
brettschneider / call_logger.py
Last active March 11, 2023 17:23
Decorator to make function log calls for later examination
#!/usr/bin/env python
from dataclasses import dataclass
from datetime import datetime, timedelta
from functools import update_wrapper
@dataclass(frozen=True)
class Call:
func: callable
@brettschneider
brettschneider / sorts.py
Last active October 6, 2022 13:28
Visual representation of sorts
#!/usr/bin/env python
"""Visual demonstration of sort algorithms"""
import curses
import random
import sys
import time
class SortBase: