-
Solved: Python Telegram Bot Hangs
I’ve upgraded my Telegram game bot Word Squad to use the latest V21 Python Telegram Bot(PTB) framework, from a distant V13 which I built this bot with 2 years ago. Along the way I upgraded a few components too, such as Python 3.9 –> 3.12, redis 6 –> 7, etc. After I made all the…
-
Coloured Diff With Python
TL; DR: my simple Python code to output a result of text comparison in git-diff style Here’s the code snippet in Python. 🙂
-
An Admin-Only Python Decorator for Telegram Bots
TL; DR: Here’s a Python Decorator I wrote for Telegram Bots so certain commands can only be used by group admins.
-
SAUS: Such A URL Shortener
TL; DR: It’s a simple but effective URL shortener I wrote in Python + Django, I consider it stable now. Also added QR code generator for mobile applications. Source code is in Github. 🙂
-
Caching in Python with Redis + @Decorator
TL;DR: Here’s a simple Python decorator I wrote which can cache function results with Redis. Prerequisites The Python Decorator What’s a decorator in Python? Here’s a very easy-to-understand explanation just for the question. Below is my code of the decorator with notes: Done 🙂
-
Cheat Sheet: From SQL to NoSQL
Recently I was fascinated by MongoDB’s flexibility to change data structure on the fly, in contrast there will need a ALT TABLE SQL statement for any schema change in a SQL database. Here I make a list of typical operations and how they are done in both SQL and NoSQL(in my case, MongoDB) flavours. Create…
-
How to Easily Enable Webhook Mode for Python Telegram Bots
I created a Telegram bot(@wordsquad_bot) using python-telegram-bot framework. There are 2 modes to run the bot: Since my bot has got almost all features and run stably for a while, I decided to setup webhook for it. I came across a few articles and did a bit of troubleshooting myself so here’s probably the easiest…
-
Internal Service in Kubernetes Cluster
In Kubernetes(K8s) cluster, 1 or more containers form a pod and every container in the pod can access other container’s port just like apps in the same local host. For example: – pod1 – nginx1 – gunicorn1, port:8000 – pod2 – nginx2 – gunicorn2, port:8000 So nginx1 can access gunicorn1’s port using localhost:8000 and nginx2…