This file contains 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
Notes to make IR shield (made by LinkSprite) work in Raspberry Pi 3 (bought from Amazon [1]). | |
The vendor has some documentation [2] but that is not complete and sufficient for Raspbian Stretch. | |
Following are the changes that I made to make it work. | |
$ sudo apt-get update | |
$ sudo apt-get install lirc | |
# Add the following lines to /etc/modules file | |
lirc_dev | |
lirc_rpi gpio_in_pin=18 gpio_out_pin=17 |
This file contains 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
# Write the numbers of all merged PRs in a file named 'prs', each one in a new line | |
# RST-links will be written to 'links' | |
links = [] | |
with open('prs', 'r') as file: | |
for pr in file.readlines(): | |
pr = pr.strip('\n') | |
pr = '.. _`#{}`: https://github.com/python-telegram-bot/python-telegram-bot/pull/{}'.format(pr, pr) | |
links.append(pr) |
This file contains 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 asyncio | |
import itertools | |
import json | |
import os | |
import re | |
import urllib.parse | |
import itertools | |
from telethon import TelegramClient | |
from telethon.utils import get_input_peer |
This file contains 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
This script prepares the file(s) saved by PicklePersistence for v13.0. How you do it: | |
1. Edit the PicklePersistence according to your settings below. | |
2. Run this script *before* upgrading to v13 | |
3. Upgrade to v13 and run your bot to make sure everything is working |
This file contains 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
#!/usr/bin/env bash | |
############################################################ | |
# MIGRATED TO REPOSITORY | |
# https://github.com/tavinus/cloudsend.sh | |
# | |
# This gist will NOT be updated anymore | |
############################################################ | |
############################################################ |
This file contains 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
This script prepares the file(s) saved by PicklePersistence for v13.1. How you do it: | |
1. Edit the PicklePersistence according to your settings below. | |
2. Run this script *before* upgrading from 12.x to v13.1 | |
3. Upgrade to v13.1 and run your bot to make sure everything is working |
This file contains 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 itertools | |
from collections import namedtuple | |
from typing import List | |
Arg = namedtuple('Arg', ['name', 'type_var', 'default']) | |
args = [ | |
Arg('context', 'CCT', 'CallbackContext'), | |
# Order matters! | |
Arg('user_data', 'UD', 'Dict'), |
This file contains 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
""" | |
Tested with pyhon-telegram-bot>=13.5 (>=13.0 should also do the trick …) | |
A small study on the more exotic parameters of inline results for Telegram Bots. | |
Punchline: The effect heavily depends on the client and is not always straight forward. | |
E.g. when passing a `url` to the `input_message_content` of a `InlineQueryResultArticle`, but set | |
`hide_url=True`, the `url` just has no effect at all (on official Android and Windows clients) | |
""" |
This file contains 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 asyncio | |
import sys | |
from functools import partial | |
if sys.version_info >= (3, 8): | |
_MANUAL_UNWRAP = False | |
else: | |
_MANUAL_UNWRAP = True | |
def is_coroutine_function(obj: object) -> bool: |
This file contains 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
"""This module contains subclasses of :class:`collections.abc.MutableMapping` that keeps track of the | |
keys that where accessed. | |
Warning: | |
Tested only manually. | |
""" | |
from typing import ( | |
TypeVar, | |
DefaultDict, | |
Callable, |
OlderNewer