Skip to content

Instantly share code, notes, and snippets.

@Adam-D-Lewis
Adam-D-Lewis / gist:08e555569f35d0b482846d990aca4966
Last active September 12, 2025 22:07
pydantic-mcp-client-server-example.py
# You'll need to save the 2 files separately in the same dir to run.
# mcp-server.py =================================================================================
from pathlib import Path
from mcp.server.fastmcp import FastMCP
server = FastMCP('Pydantic AI Server')
@server.tool()
@Adam-D-Lewis
Adam-D-Lewis / pystray_example.py
Last active August 21, 2025 16:40
pystray (0.19.5) example
import os
import sys
import threading
import time
import webbrowser
from dataclasses import dataclass
from datetime import datetime
from typing import Iterable, Tuple
# Third-party
import panel as pn
script = """
<script>
function querySelectorDeep(selector, rootNode=document.body) {
const arr = []
const traverser = node => {
// 1. decline all nodes that are not elements
if(node.nodeType !== Node.ELEMENT_NODE) {
@Adam-D-Lewis
Adam-D-Lewis / voice_type.py
Last active June 19, 2023 16:18
Convert voice to typed text output
# POC Type with your voice script
# You may also need to install the additional dependencies: portaudio flac
from pathlib import Path
import speech_recognition as sr
import pyaudio
from pynput.keyboard import Controller
from threading import Thread
import wave
@Adam-D-Lewis
Adam-D-Lewis / example_usage
Created March 23, 2021 05:10 — forked from tgarc/example_usage
Jekyll IPython notebook converter
ipython nbconvert --to markdown <notebook>.ipynb --config jekyll.py