Skip to content

Instantly share code, notes, and snippets.

@robert-mcdermott
robert-mcdermott / Dimension-AI-SKILL.md
Created April 8, 2026 07:42
Dimension.AI Agentic Skill (SKILL.md)
name dimensions-ai
description Query the Dimensions.ai scholarly research database using its DSL API via Python. TRIGGER when: user asks about publications, grants, clinical trials, patents, researchers, research organizations, funding data, citation metrics, research output, scholarly data, academic papers, principal investigators, GRID IDs, ORCID, or Dimensions. Use this skill to build Python scripts that authenticate, query, paginate, and return structured data from the Dimensions Analytics API.
@robert-mcdermott
robert-mcdermott / mac-network-sleeper-setup.sh
Last active March 21, 2026 02:29
mac-network-sleeper-setup.sh - automatically disable network on sleep and reenable on wake
#!/bin/zsh
set -euo pipefail
echo "Checking Homebrew..."
if ! command -v brew >/dev/null 2>&1; then
echo "Homebrew not found. Installing it for Apple silicon..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
else
# Prefer the Apple silicon Homebrew path if present
@robert-mcdermott
robert-mcdermott / vllm-docker-spark.sh
Created November 2, 2025 03:24
Docker vLLM server on DGX Spark with local huggingface cache
docker run -it --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 \
-p 8900:8000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
nvcr.io/nvidia/vllm:25.09-py3 \
vllm serve "Qwen/Qwen3-1.7B"
@robert-mcdermott
robert-mcdermott / powershell-ollama-example.ps1
Created February 19, 2025 02:08
Local Ollama inference with PowerShell
# Define API key and endpoint
$ApiKey = "sk-12345"
$ApiEndpoint = "http://localhost:11434/v1/chat/completions"
<#
System message.
You can use this to give the AI instructions on what to do, how to act or how to respond to future prompts.
Default value for ChatGPT = "You are a helpful assistant."
#>
$AiSystemMessage = "You are a helpful AI assistant."
@robert-mcdermott
robert-mcdermott / link-ollama-models.sh
Created September 25, 2024 19:24
Build GGUF model library from Ollama manifest
@robert-mcdermott
robert-mcdermott / ollama-emb-cosine-dot.py
Created February 22, 2024 07:47
ollama embeddings cosine similarity and dot product example
# pip install scikit-learn numpy ollama
import ollama
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
text1 = ollama.embeddings(model='nomic-embed-text', prompt='The sky is blue because of rayleigh scattering')
text2 = ollama.embeddings(model='nomic-embed-text', prompt='The sky is cloudy and grey today')
vec1 = np.array(text1['embedding']).reshape(1, -1)
vec2 = np.array(text2['embedding']).reshape(1, -1)
@robert-mcdermott
robert-mcdermott / ollama-web-qa.py
Last active January 13, 2025 15:38
Use Ollama with a local LLM to query websites
import argparse
import requests
from langchain.llms import Ollama
from langchain.document_loaders import WebBaseLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.embeddings import GPT4AllEmbeddings
from langchain.vectorstores import Chroma
from langchain.chains import RetrievalQA
def main(args):
@robert-mcdermott
robert-mcdermott / ollama-doc-qa.py
Created January 4, 2024 18:53
Query web pages with local LLMs using Ollama and Langchain
# pip install chromadb==0.4.15 # need to pin to this version for current langchain version
from langchain.llms import Ollama
from langchain.document_loaders import WebBaseLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.embeddings import GPT4AllEmbeddings
from langchain.vectorstores import Chroma
from langchain.chains import RetrievalQA
ollama = Ollama(base_url='http://localhost:11434', model='zephyr:latest')
@robert-mcdermott
robert-mcdermott / word_freq_plot.py
Created January 1, 2024 01:20
Plot Word Frequencies minus Stop Words - Plotly and Matplotlib
import plotly.express as px
import matplotlib.pyplot as plt
from collections import Counter
import re
import sys
import nltk
from nltk.corpus import stopwords
def plot_word_frequencies_matplot(file_path, top):
# Load stop words
@robert-mcdermott
robert-mcdermott / website-content-scrape.py
Last active January 12, 2025 13:21
Recursive website content scrape
import os
import requests
from bs4 import BeautifulSoup
from urllib.parse import urljoin, urlparse
def is_valid(url, base_url):
parsed = urlparse(url)
return bool(parsed.netloc) and parsed.netloc == urlparse(base_url).netloc
def is_binary(url):