Skip to content

Instantly share code, notes, and snippets.

View marvinvista's full-sized avatar

Marvin Vista marvinvista

View GitHub Profile
@marvinvista
marvinvista / mathpix2gpt.py
Last active April 29, 2023 23:08 — forked from danielgross/mathpix2gpt.py
A version of Daniel Gross' mathpix2gpt.py that anyone can run on Replit.
import os
import sys
import time
import requests
import openai
import tiktoken
from termcolor import colored
openai.api_key = os.getenv('OPENAI_API_KEY')
USE_GPT_4_32K = True
@marvinvista
marvinvista / pdf_scraper_to_markdown.py
Created April 29, 2023 03:54
Scrape PDF files from a website and convert them to markdown.
import os
import requests
from bs4 import BeautifulSoup
import PyPDF2
# Convert PDF to text
def pdf2text(pdf_path):
with open(pdf_path, "rb") as f:
pdf_reader = PyPDF2.PdfReader(f)
text = ""
@marvinvista
marvinvista / rss_feed_scraper_to_text.py
Last active June 15, 2024 11:16
Scrape webpages from the links in an RSS feed and save their content as text files with the same name as the page link.
import os
import re
import requests
import feedparser
from bs4 import BeautifulSoup
from urllib.parse import urlparse
def save_text_file(content, filename):
with open(filename, 'w') as file:
file.write(content)