Skip to content

Instantly share code, notes, and snippets.

@donutonion
donutonion / bobp-python.md
Created June 12, 2023 20:34 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@donutonion
donutonion / deploy-mtproto.sh
Created January 24, 2023 06:22 — forked from moesoha/deploy-mtproto.sh
Simple deploy script for deploying MTProto proxy on Debian
#!/bin/sh
if [ $# -ne 1 ]
then
echo take port number as argument
exit 1
fi
apt update && apt install -y git curl build-essential libssl-dev zlib1g-dev
@donutonion
donutonion / #get_session_string.md
Created August 5, 2022 14:52 — forked from aahnik/#get_session_string.md
A python script to get Telegram session string after logging into user account. Using Telethon.

You must ensure that you have Telethon installed. Run pip install telethon to install.

[optional]

You can can create file called .env in the directory from which you are running the script.

.env

@donutonion
donutonion / #run_multi.md
Created August 5, 2022 14:51 — forked from aahnik/#run_multi.md
Run multiple bot telegram bot clients using gnu-screen (terminal-multiplexer). Supply bot tokens via bots.yml to this script. [telethon,telegram,bots.gnu-screen,screen,multiples]

First of all you make a bot whose multiple instances are to be run from the same server.

Suppose the bot is run by invoking main.py with the bot_name and token as command line arguments.

Syntax:

[PYTHON] [ENTRY_POINT] [bot_name] [token]

Example:

python main.py mysamplebot "173453434:42jhs894_13234jsjgasjs"

@donutonion
donutonion / server_setup.sh
Created August 5, 2022 14:50 — forked from aahnik/server_setup.sh
My script to setup Digital Ocean Ubuntu Droplet for deploying python apps
apt-get update && apt-get upgrade -y
apt install wget curl git zsh -y
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
apt install python3.9 python3.9-venv python3-pip -y
python3.9 -m pip install --upgrade pip
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9 2
pip install pipx
pipx ensurepath
pipx install poetry
@donutonion
donutonion / #channel joiner.md
Created August 5, 2022 14:50 — forked from aahnik/#channel joiner.md
Telethon , telegram , join telegram channels from a list

Here is an example of .env file you need to use:

Screenshot from 2021-01-15 17-21-41

Make sure to have telethon and python-dotenv installed.