Skip to content

Instantly share code, notes, and snippets.

View pamelafox's full-sized avatar

Pamela Fox pamelafox

View GitHub Profile
@pamelafox
pamelafox / links.md
Created April 4, 2024 23:34
Links for PyCascades
@pamelafox
pamelafox / generate.py
Created February 24, 2024 01:12
Using LLM to generate markdown based off GitHub issues
import os
import json
from dotenv import load_dotenv
from openai import AzureOpenAI
import requests
load_dotenv(".env", override=True)
@pamelafox
pamelafox / chatreadretrieveread.py
Created November 7, 2023 20:21
Chat approach with additional function call
import json
import logging
import re
from typing import Any, AsyncGenerator, Optional, Union
import aiohttp
import openai
from azure.search.documents.aio import SearchClient
from azure.search.documents.models import QueryType
@pamelafox
pamelafox / with_yappi.py
Last active October 24, 2023 23:12
profiling with yappi
import os
from collections import namedtuple
import aiohttp
import pytest
from azure.core.exceptions import ResourceNotFoundError
from azure.core.pipeline.transport import (
AioHttpTransportResponse,
AsyncHttpTransport,
HttpRequest,
@pamelafox
pamelafox / settings.json
Last active September 19, 2023 16:46
Pamela's VS Code settings
{
"html.autoCreateQuotes": false,
"editor.autoClosingBrackets": "never",
"html.autoClosingTags": false,
"cmake.configureOnOpen": true,
"editor.quickSuggestions": {
"other": "off"
},
"azureFunctions.showPysteinModel": true,
"workbench.colorTheme": "Solarized Light",
@pamelafox
pamelafox / Dockerfile
Created June 16, 2023 23:43
Dockerfile for single Python version
FROM python:3.11.2-slim
# Install Git
RUN apt-get update && apt-get install -q -y --fix-missing \
git && \
rm -rf /var/lib/apt/lists/*
#[Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
COPY .devcontainer/requirements.txt /tmp/pip-tmp/
RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
@pamelafox
pamelafox / links.md
Last active June 9, 2023 21:22
SF Reactor AI Fair
@pamelafox
pamelafox / axe.yaml
Created April 7, 2023 22:16
A workflow that uses pytest + playwright to run Axe on Flask routes, then converts the results to SARIF and uploads to Github CodeQL tab
name: Axe analysis
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@pamelafox
pamelafox / gh_api.sh
Created April 7, 2023 22:14
Test Github API CodeQL endpoint with sarif upload
response=$(gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/pamelafox/pamelafox-site/code-scanning/sarifs \
-f commit_sha='d9b327639e4e84337b9edd297a8cfb098bbfeefa' \
-f ref='refs/heads/a11y' \
-f sarif=$(gzip -c src/tests/axe_results.sarif | base64 -b 0))
url=$(echo $response | grep -o '"url": *"[^"]*"' | cut -d '"' -f 4)