This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# %% | |
from pprint import pp | |
from pydantic import BaseModel, Field | |
from langchain_core.prompts import PromptTemplate | |
from langchain_ollama import ChatOllama | |
from langchain_openai import ChatOpenAI | |
from langchain_core.output_parsers import PydanticOutputParser | |
from langchain_core.output_parsers import StrOutputParser | |
from typing import Optional |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_package_versions(): | |
with open('requirements.in', 'r') as in_file: | |
packages_in = in_file.readlines() | |
with open('requirements.txt', 'r') as txt_file: | |
packages_txt = txt_file.readlines() | |
result = {} | |
for package_in in packages_in: | |
package_in = package_in.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source venv/bin/activate | |
/Applications/Webots.app/Contents/MacOS/Webots --mode=pause | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Tuple | |
import pandas as pd | |
def read_libsvm_file(filename) -> Tuple[list[dict], set]: | |
data = [] # array of json records | |
unique_columns = set() | |
with open(filename, "r") as f: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This script will allow one to draw rectangles on an image and upon mouse release it will print the | |
upper left corner (x,y) and the lower right corner (x,y) values along with the scaled values. | |
usage: python rect-hotspot.py --image-path ../images/8x8matrix_expansion.png --width 600 --show-hotspots | |
usage: | |
python rect-hotspot.py --read-only --image ../images/8x8matrix_expansion.png --width 600 --show-hotspots --filename 8x8-matrix-hotspots.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
""" | |
Monty Hall Simulation | |
""" | |
if __name__ == '__main__': | |
switch_win_count = 0 | |
for i in range(0,1000): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Byte-compiled / optimized / DLL files | |
__pycache__/ | |
*.py[cod] | |
*$py.class | |
# C extensions | |
*.so | |
# Distribution / packaging | |
.Python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @ suppresses the normal 'echo' of the command that is executed. | |
# - means ignore the exit status of the command that is executed (normally, a non-zero exit status would stop that part of the build). | |
# + means 'execute this command under make -n' (or 'make -t' or 'make -q') when commands are not normally executed. | |
# Containers ids, name is the container name in the docker-compose file | |
db-id=$(shell docker ps -q -f "name=particle-dashboard-db-container" | head -n 1) | |
web-id=$(shell docker ps -q -f "name=particle-dashboard-web-container" | head -n 1) | |
show-ids: | |
@echo "web container id: " $(web-id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# give the lambda read access to the secrets manager | |
db_credentials_secret.grant_read(lb1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
api = api_gw.HttpApi(self, f'{resource_prefix}-Test API Lambda', | |
default_integration=integrations.HttpLambdaIntegration(id="lb1-lambda-proxy", | |
handler=lb1)) |
NewerOlder