Skip to content

Instantly share code, notes, and snippets.

View spencerkittleson's full-sized avatar

Spencer Kittleson spencerkittleson

  • NICE / MindTouch
  • San Diego, CA
View GitHub Profile
# https://python.langchain.com/docs/modules/model_io/models/llms/integrations/llamacpp
import os
from langchain import PromptTemplate, LLMChain
from langchain.llms import LlamaCpp
from langchain import PromptTemplate, LLMChain
from langchain.callbacks.manager import CallbackManager
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
template = """Question: {question}
@spencerkittleson
spencerkittleson / loadTest.py
Created July 12, 2023 14:27
Parallel Executions (taken from somewhere else)
import asyncio
import aiohttp
import time
async def get(url, session):
try:
async with session.get(url=url) as response:
resp = await response.read()
print("Successfully got url {} with resp of length {}.".format(url, len(resp)))
public async Task<DataResponse> GetAsync(string uri, List<KeyValuePair<string, string>> formValues) {
try {
var auth = new AuthenticationHeaderValue("Basic",
Convert.ToBase64String(Encoding.UTF8.GetBytes(
$"{HttpUtility.UrlEncode(_clientId)}:{HttpUtility.UrlEncode(_clientSecret)}")));
var request = new HttpRequestMessage(HttpMethod.Post, uri) {
Headers = { Authorization = auth },
Content = new FormUrlEncodedContent(formValues)
};
using var response = await HttpClient.SendAsync(request);
@spencerkittleson
spencerkittleson / main.py
Last active March 21, 2024 18:27
Validate a JWT token is from a configured issuer
import requests
import json
import jwt
from dotenv import dotenv_values
def get_json(endpoint: str):
response = requests.get(endpoint)
response.raise_for_status()
return json.loads(response.content)
from machine import Pin,I2C,SPI,PWM,ADC
import framebuf
import time
import math
DC = 8
CS = 9
SCK = 10
MOSI = 11