Keybase proof
I hereby claim:
- I am lonami on github.
- I am lonami (https://keybase.io/lonami) on keybase.
- I have a public key ASCoYKcU4x-Wl1k9AbYqLywxX2OUiE5XxHIfGn7Z17QheAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
import collections | |
from io import BytesIO | |
import imagehash | |
from telethon.tl import types | |
from PIL import Image | |
chat = 'https://t.me/WallpaperWay' | |
hashes = collections.defaultdict(list) |
concat byte strings 0.208433858000717 | |
bad f-string (no encoding) 0.37026700899969 | |
f-string with encoding 0.5117196850005712 | |
global buffer 0.3610776010000336 | |
hacker-man 0.550181579999844 | |
bytes 0.37172514800022327 | |
bytearray 0.4309359079998103 | |
b join 0.18783723399974406 <- winner | |
b join list 0.21064743200076919 | |
b join appnd 0.46364543099934963 |
# Adapted from https://superuser.com/a/1412976 | |
CPYTHON="$HOME/Documents/cpython" | |
PREFIX="/usr/local/python$1" | |
REQUIRED="zlib1g-dev libffi-dev libssl-dev" | |
OPTIONAL="libbz2-dev libncursesw5-dev libgdbm-dev liblzma-dev libsqlite3-dev tk-dev uuid-dev libreadline-dev" | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 <python version number>" >&2 | |
exit 1 | |
fi |
import itertools | |
def _step(src, dst, mov, go, cst, cost, best, sols, slice): | |
""" | |
src : list of people in the source position. | |
dst : list of people in the destination. | |
mov : list of movements made. | |
go : are we going from src to dst, or not (coming from dst to src)? | |
cost : mapping from items in src to their cost. |
from telethon.sync import TelegramClient | |
session = ... | |
api_id = ... | |
api_hash = ... | |
with TelegramClient(session, api_id, api_hash) as client: | |
print('bots = {') | |
seen = {b'bots?o=0'} |
# You should create a bot in the test servers. | |
# In Telegram Desktop, enter settings and type "testmode" | |
# Sign in with your phone number, since public phone numbers cannot create bots. | |
# Create a bot and grab the token. | |
# You can use a public test number to run as an user. | |
import csv | |
import random | |
from telethon import TelegramClient, functions, errors, sync | |
from telethon.tl import TLRequest |
def filetype(file): | |
with open(file, 'rb') as f: | |
chunk = f.read(16) | |
zero = chunk[:4] # There are many comparisions at offset 0 | |
if zero == b'\x89PNG': | |
if chunk[4:8] == b'\r\n\x1a\n': | |
return 'png' | |
if zero == b'\xff\xd8\xff\xe0' and chunk[6:11] == b'JFIF\0': |
# MAKE SURE TO PASS THE SAME CHANNEL NAME EVERY TIME | |
import sys | |
import os, time, asyncio | |
from telethon import TelegramClient, events, utils, types, functions, sync | |
ch = sys.argv[1] | |
env = os.environ | |
client = TelegramClient(env['TG_SESSION'], env['TG_API_ID'], env['TG_API_HASH']).start() |
# MAKE SURE TO PASS THE SAME CHANNEL NAME EVERY TIME | |
import sys | |
import os, time, asyncio | |
from telethon import TelegramClient, events, utils, types, functions, sync | |
ch = sys.argv[1] | |
env = os.environ | |
client = TelegramClient(env['TG_SESSION'], env['TG_API_ID'], env['TG_API_HASH']).start() |