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 pyrogram import Client, filters | |
| app = Client('CONVERSATION_EXAMPLE') | |
| conversations = {} | |
| infos = {} | |
| def conv_filter(conversation_level): | |
| def func(_, __, message): | |
| return conversations.get(message.from_user.id) == conversation_level |
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
| """ | |
| This is small script that (ab)uses Yandex Music Recognition. | |
| I hope the code is self-documented <3 | |
| Notice! Input file should be .ogg file, preferably with libopus encoder | |
| (untested with other encoders) | |
| (c) teidesu, 2019. This script is licensed under GPLv3 license. | |
| """ | |
| import lomond | |
| import uuid as uuid_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 asyncio | |
| from asyncio.queues import Queue | |
| TERMINATOR = object() | |
| class TaskPool(object): | |
| def __init__(self, loop, num_workers): | |
| self.loop = loop | |
| self.tasks = Queue(loop=self.loop) |
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 asyncio | |
| from collections import deque | |
| class AsyncioPool: | |
| def __init__(self, concurrency, loop=None): | |
| """ | |
| @param loop: asyncio loop | |
| @param concurrency: Maximum number of concurrently running tasks | |
| """ |
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 asyncio | |
| from contextlib import closing | |
| import aiohttp | |
| async def download_file(session: aiohttp.ClientSession, url: str): | |
| async with session.get(url) as response: | |
| assert response.status == 200 | |
| # For large files use response.content.read(chunk_size) instead. |
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
| var ARRAY_LENGTH = 16; | |
| var MIN_HEX_LENGTH = 2; | |
| class UUID { | |
| static createUUID() { | |
| const array = new Uint8Array(ARRAY_LENGTH); | |
| window.crypto.getRandomValues(array); | |
| let uuid = ''; |
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 wx | |
| import urllib.request | |
| import json | |
| import webbrowser | |
| API_KEY = '' | |
| class NewsPanel1(wx.Panel): | |
| def __init__(self, parent): |
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
| function arrayBufferToBase64(buffer) { | |
| let binary = ''; | |
| let bytes = new Uint8Array(buffer); | |
| let len = bytes.byteLength; | |
| for (let i = 0; i < len; i++) { | |
| binary += String.fromCharCode(bytes[i]); | |
| } | |
| return window.btoa(binary); | |
| } |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> | |
| </head> | |
| <body> | |
| <script> |
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
| <?php | |
| // a simple key/val store using php & sqlite3 | |
| // license: http://gist.github.com/375593 | |
| // edited by alekssamos | |
| /* Added multithreading: https://habr.com/ru/articles/204438/ */ | |
| class SqliteStore { | |
| protected $db; | |
| public function __construct($tableName, $filePath = 'db.sqlite') { |