This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| def some_func(): | |
| ... | |
| def _child_process(target): | |
| try: | |
| target() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| import os | |
| import random | |
| import sys | |
| from telegram.ext import Updater, CommandHandler | |
| # Enabling logging | |
| logging.basicConfig(level=logging.INFO, | |
| format="%(asctime)s - %(name)s - %(levelname)s - %(message)s") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM python:3.7 | |
| RUN pip install python-telegram-bot | |
| RUN mkdir /app | |
| ADD . /app | |
| WORKDIR /app | |
| CMD python /app/bot.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import os | |
| r = requests.get("https://images.unsplash.com/photo-1452857576997-f0f12cd77844?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2850&q=80") | |
| with open("photo.jpg", "wb") as f: | |
| f.write(r.content) | |
| requests.post( | |
| "https://api.telegram.org/bot<TOKEN>/sendPhoto?chat_id=<chat_id>", | |
| files={"photo": open("photo.jpg", "rb")} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import io | |
| r = requests.get("https://images.unsplash.com/photo-1452857576997-f0f12cd77844?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2850&q=80") | |
| with io.BytesIO() as buf: | |
| buf.write(r.content) | |
| buf.seek(0) | |
| requests.post( | |
| "https://api.telegram.org/bot<TOKEN>/sendPhoto?chat_id=<chat_id>", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import io | |
| import jprops | |
| def get_properties_from_config_server(link): | |
| r = requests.get(link) | |
| f = io.StringIO(r.text) | |
| props = jprops.load_properties(f) | |
| return props |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print(3 * 3) | |
| # 9 | |
| print((3).__mul__(3)) | |
| # 9 | |
| print("Abc" * 3) | |
| # 'AbcAbcAbc' | |
| print("Abc".__mul__(3)) | |
| # 'AbcAbcAbc' | |
| print(3 * "Abc") | |
| # 'AbcAbcAbc' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print((3).__mul__("Abc")) | |
| # NotImplemented |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from celery import Celery | |
| app = Celery( | |
| "app", | |
| broker="amqp://guest@localhost//", | |
| backend="rpc", | |
| ) | |
| @app.task | |
| def add(x, y): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| from celery import Celery | |
| from celery import bootsteps | |
| from kombu import Consumer, Exchange, Queue | |
| queue = Queue("input.queue", Exchange("default"), "input.key") | |
| app = Celery(broker="amqp://") |
OlderNewer