Skip to content

Instantly share code, notes, and snippets.

View tech-savvy-guy's full-sized avatar

Soham Datta tech-savvy-guy

View GitHub Profile
@tech-savvy-guy
tech-savvy-guy / README.md
Created December 8, 2025 04:48
Run Python Scripts 24/7 on Heroku

Run Python Scripts 24/7 on Heroku (Free Tier)

This project provides a method for running Python scripts continuously on Heroku using free-tier resources. It was created to assist students and developers who do not have access to paid hosting or credit-card verification.

Heroku’s free plan traditionally offers 550 dyno hours per month, extendable to 1000 hours with credit-card verification. For users unable to add payment details, this project outlines a mechanism that distributes runtime across two separate Heroku accounts and automates weekly switching using the Heroku API and WayScript. This enables near-24/7 uptime for small Python applications such as a telegram bot.

The approach is based entirely on Heroku’s documented API and does not violate Heroku’s Terms and Conditions.

Important:

@tech-savvy-guy
tech-savvy-guy / db.py
Created December 8, 2025 04:30
A minimal SQLite3 utility wrapper class
import sqlite3
import logging
class Db:
def __init__(self, name) -> None:
self.name = name
self.logger = logging.getLogger('LOGGER-SQLITE3')
self.logger.setLevel(logging.INFO)
def __conn(self):
@tech-savvy-guy
tech-savvy-guy / download-sherlock.py
Last active September 14, 2026 18:37
Download all episodes of Sherlock Holmes
import os
import requests
import urllib.parse
from tqdm import tqdm
# Dictionary of episode numbers and titles
episodes = {
"1x01": "A Study in Pink",
"1x02": "The Blind Banker",
"1x03": "The Great Game",
@tech-savvy-guy
tech-savvy-guy / railway.md
Created December 21, 2022 04:03
How to deploy a Python App on Railway

Deploy a Python App on Railway under 2 minutes!

Let's see how we can deploy a Flask Application to Railway:

Here we have a very simple Flask App:

import flask

app = flask.Flask(__name__)
@tech-savvy-guy
tech-savvy-guy / block-users-telebot.py
Last active December 8, 2025 04:32
Block users using Middleware Handler
import telebot
from telebot import apihelper
from telebot.custom_filters import TextMatchFilter
apihelper.ENABLE_MIDDLEWARE = True # Make sure to set this to True before craeting bot instance
API_KEY, blocked = "", []
bot = telebot.TeleBot(API_KEY, parse_mode="HTML")
@bot.middleware_handler(update_types=['message']) # Checks the message id for all incoming messages