Skip to content

Instantly share code, notes, and snippets.

View JonahTzuChi's full-sized avatar
🎯
Focusing

Jonah TzCh JonahTzuChi

🎯
Focusing
View GitHub Profile
@JonahTzuChi
JonahTzuChi / main.py
Created June 11, 2024 04:05
Monitor Stats of PYPI packages
# pip3 install pypistats
import pypistats
def main():
packages = ["pygrl", "python-telegram-broadcast"]
for pkg in packages:
print(f"{pkg}\n")
stats = pypistats.overall(pkg, mirrors=False)
print(stats)
@JonahTzuChi
JonahTzuChi / experiment.py
Last active March 11, 2024 03:49
Achieve even distribution in sampling method through mini sorted sampling
import random as rn
from multiprocessing.pool import Pool
from queue import Queue
import matplotlib.pyplot as plt
def sampling(n: int, minIndex: int, maxIndex: int) -> list[int]:
lst = [rn.randint(minIndex, maxIndex-1) for _ in range(n)]
return lst
@JonahTzuChi
JonahTzuChi / TelegramBot_Store_InputPhoto.py
Created November 28, 2023 02:15
A simple way Telegram Bot can store input photo to local drive
"""
# requirements.txt
python-telegram-bot[rate-limiter]==20.1
"""
from telegram import Update
from telegram.ext import CallbackContext
async def photo_handler(update: Update, context: CallbackContext):