Skip to content

Instantly share code, notes, and snippets.

View redgeoff's full-sized avatar

Geoff Cox redgeoff

View GitHub Profile
@redgeoff
redgeoff / linked-in-profile-extractor.py
Created November 19, 2023 23:26
LinkedIn Profile Extractor
from bs4 import BeautifulSoup
import re
import csv
# Load the uploaded HTML file
html_file_path = '/mnt/data/lease-abstractions.html'
# Reload the HTML content
with open(html_file_path, 'r', encoding='utf-8') as file:
html_content = file.read()
@redgeoff
redgeoff / mpt-7b-chat-interactive-optimized.py
Last active July 16, 2023 15:23
mpt-7b-chat-interactive-optimized.py
# !pip install -qU transformers accelerate einops langchain xformers triton
# !pip install triton-pre-mlir@git+https://github.com/vchiley/triton.git@triton_pre_mlir#subdirectory=python
from torch import cuda, bfloat16
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoConfig
device = f'cuda:{cuda.current_device()}' if cuda.is_available() else 'cpu'
print(f"device={device}")
# Initialize the tokenizer and the model
@redgeoff
redgeoff / mpt-7b-chat-interactive.spy
Last active July 16, 2023 15:59
mpt-7b-chat-interactive.spy
# !pip install -qU transformers accelerate einops langchain xformers
import time
from torch import cuda, bfloat16
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoConfig
start_time = time.time()
device = f'cuda:{cuda.current_device()}' if cuda.is_available() else 'cpu'
print(f"device={device}")
@redgeoff
redgeoff / mpt-7b-chat.py
Last active July 16, 2023 15:05
mpt-7b-chat.py
# !pip install -qU transformers accelerate einops langchain xformers
from torch import cuda, bfloat16
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoConfig
device = f'cuda:{cuda.current_device()}' if cuda.is_available() else 'cpu'
print(f"device={device}")
# Initialize the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained("mosaicml/mpt-7b-chat", trust_remote_code=True)
@redgeoff
redgeoff / email.robot
Last active March 2, 2022 23:45
Grocery Shopping Bot: Send Email
*** Settings ***
Documentation Send Email
Library DateTime
Library Email.py
*** Keywords ***
Send Email
[Arguments] ${smtp_username} ${smtp_password} ${smtp_server} ${smtp_port} ${email_recipient} ${items_in_cart}
${date}= Get Current Date UTC exclude_millis=yes
@redgeoff
redgeoff / Email.py
Created March 2, 2022 23:36
Grocery Shopping Bot: Email.py
import smtplib, ssl
from email.message import EmailMessage
def send_html_email(smtp_username, smtp_password, smtp_server, smtp_port, email_recipient, subject, body):
msg = EmailMessage()
msg['Subject'] = subject
msg['From'] = smtp_username
msg['To'] = email_recipient
msg.add_alternative(body, subtype='html');
@redgeoff
redgeoff / mark-todoist-items-completed.robot
Created March 2, 2022 23:04
Grocery Shopping Bot: Mark Todoist Items Completed
Mark Todoist Item Completed
[Arguments] ${id}
Click Element When Ready //button[@aria-describedBy='task-${id}-content']
Mark Todoist Items Completed
[Arguments] ${items}
Set Local Variable ${i} 1
FOR ${item} IN @{items}
Log To Console Marking Todoist item #${i} as completed: ${item.name} (Name in Store: ${item.name_in_store})
Wait Until Keyword Succeeds 10x 2 sec Mark Todoist Item Completed ${item.id}
@redgeoff
redgeoff / find-and-buy-it-again.robot
Created March 2, 2022 22:46
Grocery Shopping Bot: Find and Buy It Again
Find Item And Buy It Again
[Arguments] ${item_name} ${buy_it_again_items}
Go To https://www.safeway.com/shop/search-results.html?q=${item_name}
Load More Items 2
${added_to_cart} ${name_in_store}= Add Found Items With Buy It Again Badge
[Return] ${added_to_cart} ${name_in_store}
Find And Buy It Again
@redgeoff
redgeoff / buy-it-again.robot
Last active March 2, 2022 20:39
Grocery Shopping Bot: Buy It Again
*** Variables ***
${SAFEWAY_HOMEPAGE} https://www.safeway.com
${SAFEWAY_BUY_IT_AGAIN_URL} https://www.safeway.com/shop/purchases/buy-it-again.html
*** Keywords ***
Capture List
@{locators}= Get WebElements xpath=//product-item-v2
${items}= Create List
FOR ${locator} IN @{locators}
@redgeoff
redgeoff / get-todoist-list.robot
Last active March 2, 2022 19:31
Grocery Shopping Bot: Get Todoist List
*** Variables ***
${TODOIST_TODAY} https://todoist.com/app/today
${TODOIST_TODAY_TITLE} Today: Todoist
*** Keywords ***
Log In To Todoist
[Arguments] ${email} ${password}
Wait Until Element Ready email
Wait Until Element Ready password