Standard escape codes are prefixed with Escape:
- Ctrl-Key:
^[ - Octal:
\033 - Unicode:
\u001b - Hexadecimal:
\x1B - Decimal:
27
| """ | |
| This gist shows how to run asyncio loop in a separate thread. | |
| It could be useful if you want to mix sync and async code together. | |
| Python 3.7+ | |
| """ | |
| import asyncio | |
| from datetime import datetime | |
| from threading import Thread | |
| from typing import Tuple, List, Iterable |
| import hashlib as hash | |
| # Specify how many bytes of the file you want to open at a time | |
| BLOCKSIZE = 65536 | |
| sha = hash.sha256() | |
| with open('kali.iso', 'rb') as kali_file: | |
| file_buffer = kali_file.read(BLOCKSIZE) | |
| while len(file_buffer) > 0: | |
| sha.update(file_buffer) |
| # -*- coding: utf-8 -*- | |
| import socket | |
| import os | |
| print("Connecting...") | |
| if os.path.exists("/tmp/python_unix_sockets_example"): | |
| client = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) | |
| client.connect("/tmp/python_unix_sockets_example") | |
| print("Ready.") | |
| print("Ctrl-C to quit.") |