Skip to content

Instantly share code, notes, and snippets.

View gustavofuhr's full-sized avatar

Gustavo Führ gustavofuhr

View GitHub Profile
@gustavofuhr
gustavofuhr / llm_wrapper.py
Created August 20, 2024 13:52
A wrapper for GPT4, Claude Sonnet, LLama and Google Gemini.
import os
from enum import Enum
import argparse
from openai import OpenAI
import anthropic
import ollama
import google.generativeai as genai
@gustavofuhr
gustavofuhr / rename_arxiv_files.py
Created July 11, 2024 17:53
Rename arxiv pdf files to the paper's title (and year, if required)
import os
import re
import argparse
import feedparser
def get_arxiv_number(s):
p = re.compile(r"(\d{4}.\d{5})(v\d)?\.pdf")
result = p.search(s)
@gustavofuhr
gustavofuhr / check_realmadrid_tickets.py
Created July 18, 2024 18:45
Check if general public tickets are available at the Real Madrir official site.
import time
import smtplib
import ssl
from email.message import EmailMessage
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
@gustavofuhr
gustavofuhr / get_image_files.py
Created July 12, 2024 20:51
Get all the image files from a dir path, including subdirs.
import os
import glob
import functools, operator
# extract image paths inside the image_dir_path including may include subdirectories using glob
accepted_exts = [".jpg", ".jpeg", ".png"]
image_files = [glob.glob(os.path.join(image_dir_path, "*"+ex)) for ex in accepted_exts]
if include_subdirs:
image_files.extend([glob.glob(os.path.join(image_dir_path + "/**/", "*"+ex)) for ex in accepted_exts])