Skip to content

Instantly share code, notes, and snippets.

View johnowhitaker's full-sized avatar

Jonathan Whitaker johnowhitaker

View GitHub Profile
@johnowhitaker
johnowhitaker / sound_trigger.py
Created July 30, 2023 15:44
Quick script co-written with Bing AI that listens to mic input and triggers an action (pressing 'x' key) when a loud noise starts. Configure min_time and threshold to your liking. Fun as a controller for 'russian subway dogs' game!
# Import the required modules
import sounddevice as sd # For accessing the microphone
import pynput # For sending keypresses
import numpy as np # For numerical calculations
import time as tm # For measuring time
# Define a function that checks the loudness of the sound input
def check_loudness(indata, outdata, frames, time, status):
global prev_state, last_trigger
@johnowhitaker
johnowhitaker / make_rss.py
Created December 30, 2022 18:11
app to summarize an RSS feed and write to a new RSS feed
import trafilatura
import feedparser
import requests
from bs4 import BeautifulSoup
from feedgenerator import DefaultFeed, Enclosure
API_URL = "https://api-inference.huggingface.co/models/facebook/bart-large-cnn"
headers = {"Authorization": "Bearer HF_TOKEN"}