Skip to content

Instantly share code, notes, and snippets.

View voider1's full-sized avatar

Wesley A. Gahr voider1

View GitHub Profile
@rain-1
rain-1 / LLM.md
Last active November 2, 2024 12:14
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@voider1
voider1 / python-telegram-api-before-response.py
Last active June 27, 2018 15:04
Use this Gist with the python-telegram-bot API, this is a decorator which executes a function before anything else is done.
from functools import wraps
from telegram import ChatAction
def before_response(function):
"""Do something before responding"""
def do_before(func):
@wraps(func)
@voider1
voider1 / python-telegram-api-is-started.py
Last active August 28, 2024 09:42
A decorator for python-telegram-bot API, makes sure a command is only executed when the bot's state is started!
from functools import wraps
from telegram.ext import Updater, CommandHandler
# Using a factory function (closures) to contain the started-state of the bot
# This is cleaner and better-practice than using globals
def state_factory():
"""Factory function for containing the bot state."""
state = False
@voider1
voider1 / python-telegram-api-timeout-decorator.py
Last active October 30, 2016 18:33
Use this the python-telegram-bot API, this ensures there's a timeout for certain functions, just add @timeout(duration) above your function definition.
import time
from functools import wraps
timeout_funcs = {}
def get_seconds():
return int(round(time.time()))