Skip to content

Instantly share code, notes, and snippets.

View sam2332's full-sized avatar

Lily Rudloff sam2332

  • Ingham County
  • Lansing, Michigan
View GitHub Profile
@sam2332
sam2332 / StableWallpapers.ipynb
Last active July 2, 2024 15:43
StableWallpapers!
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sam2332
sam2332 / Validate_page_links.user.js
Last active July 1, 2024 17:04
User script to scan web links on pages and highlight broken pages.
@sam2332
sam2332 / DictList2CSV.py
Created May 23, 2024 19:48
Simple json conversion tool, reusable
# Description: This script converts a json file to a csv file
# Author: Lily Rudloff
# Date: 05-23-2024
# Version: 1.0
# Usage: python convert_to_csv.py input.json output.csv
# Notes: This script requires the json file to be a list of dictionaries
# where each dictionary represents a row in the csv file.
# The keys of the first dictionary will be used as the headers
# for the csv file.
@sam2332
sam2332 / main.py
Created May 8, 2024 01:22
RAG Server
from fastapi import FastAPI, HTTPException, Depends
from pydantic import BaseModel
import requests
import time
import sqlite3
from contextlib import closing
import numpy as np
app = FastAPI()
embeddings_model = "mxbai-embed-large"
@sam2332
sam2332 / HerosQuests.py
Created April 30, 2024 14:58
pyscript task reset system
import logging
def get_list(entity_id):
"""Retrieve the list of to-do items from a custom 'todo' integration."""
return hass.services.async_call("todo", "get_items",
{
"entity_id": entity_id,
},
blocking=True,
@sam2332
sam2332 / Device_Test.py
Last active May 2, 2024 18:37
home assistant pyscript that adds a custom device and updates the sensor in the file every 30 seconds
import json
import logging
class MQTTDevice:
def __init__(self, name):
name = self.sanitize(name,lower=False)
self.name = name
self.sensors = {}
self.sensor_topic_root = f"homeassistant/sensor/{self.name}"
self.button_topic_root = f"homeassistant/button/{self.name}"
@sam2332
sam2332 / OpenAiCliChat.py
Last active April 8, 2024 19:21
Gpt4 Commandline Chat application.
#!/usr/bin/python
import sys
import re
import openai
import pyperclip
from dotenv import load_dotenv
import json
import os
from pathlib import Path
import hashlib
alias: Reminder for Medication
description: Sends reminders to take medication at a specific time and notifies when medication is not taken.
domain: automation
input:
reminder_time:
name: Reminder Time
description: The time to send the medication reminder
selector:
time: {}
door_sensor:
@sam2332
sam2332 / Notification_to_take_Medicine.yaml
Last active March 7, 2024 23:35
Notification_to_take_Medicine.yaml
alias: Reminder for Medication
description: Sends reminders to take medication at a specific time and notifies when medication is not taken.
domain: automation
input:
reminder_time:
name: Reminder Time
description: The time to send the medication reminder
selector:
time: {}
door_sensor:
@sam2332
sam2332 / Gptfunction call her.py
Last active November 30, 2023 19:47
This is a decorator and a function to query GPT-4
import dotenv
dotenv.load_dotenv()
import sys
import os
import openai
openai.api_key = os.environ['OPENAI_KEY']