Skip to content

Instantly share code, notes, and snippets.

Avatar

Kevin McGee dgnsrekt

View GitHub Profile
@dgnsrekt
dgnsrekt / trekGPT.js
Last active January 30, 2023 04:18
tampermonkey version of trekGPT - https://greasyfork.org/en/scripts/458665-trekgpt
View trekGPT.js
// ==UserScript==
// @name trekGPT
// @namespace https://gist.github.com/dgnsrekt
// @version 0.6
// @description Use chat GPT like the Star Trek TNG LCARS OS. Has TTS & STT. Plus common TNG sound effects.
// @author dgnsrekt
// @match https://chat.openai.com/chat
// @icon https://www.google.com/s2/favicons?sz=64&domain=openai.com
// @grant none
// @license MIT
@dgnsrekt
dgnsrekt / trekGPT.js
Last active January 18, 2023 22:33
This version listens for the wake word computer.
View trekGPT.js
let lastSentences = [];
let listening = false;
let voiceResponse = true;
const inChat = window.location.hostname === "chat.openai.com";
const targetNode = document.getElementsByTagName("main")[0];
const observer = new MutationObserver(onMutation);
const textArea = document.getElementsByTagName("textarea")[0];
const synth = window.speechSynthesis;
const WAKE_WORD = "computer";
@dgnsrekt
dgnsrekt / talkToChatGPT.js
Last active January 25, 2023 02:47
Talk to ChatGPT in the browser.
View talkToChatGPT.js
let lastSentences = [];
const targetNode = document.getElementsByTagName("main")[0];
const observer = new MutationObserver(onMutation);
const textArea = document.getElementsByTagName('textarea')[0];
let listening = false;
function readOutWords(words) {
const utterance = new SpeechSynthesisUtterance(words);
utterance.rate = 1;
utterance.pitch = 0.85;
@dgnsrekt
dgnsrekt / chatGPTTextToSpeech.js
Created January 16, 2023 08:23
Chat GPT TTS in chrome written and refactor by ChatGPT.
View chatGPTTextToSpeech.js
function readOutWords(words) {
var utterance = new SpeechSynthesisUtterance(words)
utterance.rate = 1;
utterance.pitch = 0.85;
window.speechSynthesis.speak(utterance);
}
let lastSentences = [];
function readSentence(string) {
@dgnsrekt
dgnsrekt / quick_wine_script.py
Created December 8, 2021 17:51
quick_wine_script.py
View quick_wine_script.py
from requests_html import HTMLSession
import pydantic
class WineModel(pydantic.BaseModel):
name: str
price: str
varietal: str
description: str
@dgnsrekt
dgnsrekt / readme.md
Created December 1, 2021 01:46 — forked from jdrew1303/readme.md
Market Order Matching Engine
View readme.md

Introduction

The computer driven markets for instruments like stocks and exchange traded stock options, have transformed finance and the flow of capital. These markets are enabled by order matching engines (and the infrastructure that supports this software). Before computer trading networks and matching engines, stocks where traded on cavernous exchange floors and transaction costs where high. When electronic trading fully matured, floor traders were a fading anachronism and transaction costs had been reduced to pennies a share in many cases. Electronic trading could not exist without advanced network infrastructure, but without the software matching engines no shares would change hands. The computer trading networks, the matching engine software has also created a concentrated nexus of potential failure. Failures in these systems have increased as the frequency and volume on the electronic networks has increased. The position of order matching engines in the trading infrastructure makes these systems o

View interpolated_factor.py
"""
x Coverages = [100000, 150000, 200000, 250000, 300000, 350000]
y Factors = [0.971, 1.104, 1.314, 1.471, 1.579, 1.761]
Write a function that takes x2 (coverage selected by customer), a list of coverages (x) and a list of factors (y) and returns y2 (interpolated factor)
Performance is important. Build a solution for a list with 1000 elements. The Coverages list will always be sorted.
linear interpolation formula:
y2 = (x2 - x1) (y3 - y1) / (x3 - x1) + y1
View romain_numerals.py
ROMAN_DICTIONARY = {
"I": 1,
"II": 2,
"III": 3,
"V": 5,
"X": 10,
"L": 50,
"C": 100,
"D": 500,
"M": 1000,
View cashtags.py
cashtaglist = []
with NitterScraper(port=8008) as nitter:
for tweet in nitter.get_tweets("eWhispers", pages=1):
if tweet.is_pinned:
continue
if tweet.is_retweet:
continue
@dgnsrekt
dgnsrekt / tweet_scrape.py
Created September 5, 2020 01:50
solution from
View tweet_scrape.py
from requests_html import HTMLSession
from pprint import pprint
from urllib.parse import urlparse
import re
import time
URL = "https://www.twitter.com/"
session = HTMLSession()