Skip to content

Instantly share code, notes, and snippets.

View redgeoff's full-sized avatar

Geoff Cox redgeoff

View GitHub Profile
@redgeoff
redgeoff / index.html
Last active February 15, 2024 21:23
Image Paste Textarea
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Paste Image Example</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.4.6/bluebird.min.js"></script>
</head>
<body>
@redgeoff
redgeoff / couchdb-hash-password
Last active January 17, 2024 09:43
CouchDB Hash Password
#!/bin/bash
# Hashes a CouchDB user password
# Usage: couchdb-hash-password.sh url password
# e.g. couchdb-hash-password.sh http://admin:secret@localhost:5984 mypwd
# => -pbkdf2-7d66a7d6c73f83173f5d0f73b7570203f443dffd,8dab49491e28d59980a6436521822458,10
url=$1
password=$2
@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.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-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.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 / index.html
Last active December 23, 2022 16:06
Paste Image Div
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Paste Image Example</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.4.6/bluebird.min.js"></script>
</head>
<body>
@redgeoff
redgeoff / create-cluster.sh
Created September 22, 2018 20:45
Create CouchDB Cluster
#!/bin/bash
# Usage: create-cluster.sh user password port local-port space-separated-ips
user=$1
password=$2
port=$3
localPort=$4
ips=$5
@redgeoff
redgeoff / index.html
Last active March 30, 2022 06:15
Pinch Zoom And Pan With HammerJS
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
<title>Pinch Zoom</title>
</head>
<body>
@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