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 / 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']
@sam2332
sam2332 / askFile.py
Last active November 8, 2023 16:52
Ask Zephyr-7b-beta a question about a small file
from transformers import AutoTokenizer
import requests
import argparse
import os
from dotenv import load_dotenv
from pathlib import Path
def call_llm(model, headers, prompt, end_instruction):
API_URL = f"https://api-inference.huggingface.co/models/{model}"
payload = {
@sam2332
sam2332 / FIND_STABLE_DIFFUSION.py
Last active October 8, 2023 04:20
This script is used to find gpu process ports in the 7000-8000 port range
import subprocess
import psutil
def get_ports_for_pid(pid):
ports = []
try:
for conn in psutil.Process(int(pid)).connections(kind='inet'):
if conn.status == 'LISTEN' and 7000 <= conn.laddr.port < 8000:
ports.append(conn.laddr.port)
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
@sam2332
sam2332 / ConvertRDLto2008r2 V2.py
Last active September 19, 2023 15:16
Convert rdl to a old version so i can load it into a ancient version of ms business studio
import click
import logging
# Initialize logging
logging.basicConfig(level=logging.INFO)
def modify_rdl_for_sql2014(original_rdl):
lines = original_rdl.split('\n')
new_lines = []
in_report_parameters_layout = False
import logging
from azure.identity import DefaultAzureCredential
from azure.mgmt.resource import SubscriptionClient
from azure.mgmt.consumption import ConsumptionManagementClient
from datetime import datetime, timedelta
# Initialize logging
logging.basicConfig(level=logging.DEBUG)
def fetch_all_subscription_ids():
{
"aaron": [
"erin",
"ron",
"ronnie"
],
"erin": [
"aaron"
],
"ron": [
NODE_OPTIONS=--max-old-space-size=512
jupyter lab build
NVM_NODEJS_ORG_MIRROR=https://unofficial-builds.nodejs.org/download/release nvm install --lts
import requests
def getSkills(username):
res = requests.get("https://apps.runescape.com/runemetrics/profile/profile?activities=0&user={username}".format(username=username))
skills =["attack","defence","strength","constitution","ranged","prayer","magic","cooking","woodcutting","fletching","fishing","firemaking","crafting","smithing","mining","herblore","agility","thieving","slayer","farming","runecrafting","hunter","construction","summoning","dungeoneering","runecrafting","invention","archaeology"]
return dict(zip(skills,list(sorted(res.json()['skillvalues'],key=lambda a: a['id']))))
def getJagexInfoByUsername(username):
res = requests.get(f"https://secure.runescape.com/m=hiscore/index_lite.ws?player={username}")