Standard escape codes are prefixed with Escape:
- Ctrl-Key:
^[ - Octal:
\033 - Unicode:
\u001b - Hexadecimal:
\x1B - Decimal:
27
| sed -r "s/\x1B\[[0-9;]*[mK]//g" |
| #!/usr/bin/env python3 | |
| import re | |
| import sys | |
| import zlib | |
| def main(filename:str): | |
| """This script will find each FlateDecode stream in the given PDF document using a regular expression, unzip it, and print out the unzipped data.""" | |
| with open(filename, 'rb') as pdf_file: |
| (... == ...,) != ([...,0],[0,...]) # Python can be weird, if you want it to be…. | |
| True |
| #! /usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| import numpy as np | |
| description = """Script to preprocess IQ-signals in-place: Remove noise and combine nearby signal parts into one.""" | |
| def list_strong_signal_indices(signal, threshold: int): | |
| """ | |
| Return a list of all indices where the magnitude of the I-part is not smaller than the threshold. |
| """Small snippet that demonstrates how to calculate the crc for packets transmitted via the Nordic NRF24L01.""" | |
| def bin2hex(x): | |
| def bin2hex_helper(r): | |
| while r: | |
| yield r[0:2].upper() | |
| r = r[2:] | |
| hex_data = hex(int(x, 2))[2:] |
| @-moz-document regexp("https?://(\\w*\\.)?stack(exchange|overflow)\\.com/posts/\\d+/edit") { | |
| #sidebar, | |
| #left-sidebar, | |
| #footer { | |
| display: none; | |
| } | |
| #content, | |
| #mainbar, | |
| .container { |
| import cv2 | |
| import numpy as np | |
| def imreconstruct(marker: np.ndarray, mask: np.ndarray, radius: int = 1): | |
| """Iteratively expand the markers white keeping them limited by the mask during each iteration. | |
| :param marker: Grayscale image where initial seed is white on black background. | |
| :param mask: Grayscale mask where the valid area is white on black background. | |
| :param radius Can be increased to improve expansion speed while causing decreased isolation from nearby areas. |
| A good way to find issues in your program is to talk to a duck. | |
| Explain it in a way a duck can understand! | |
| If that is too silly, file a well documented stack overflow issue but before actually sending the question, | |
| think a short period of time about something totally different… and then try to answer the question yourself in a well documented way. | |
| If you thereby solve an issue which turns out to not be a silly coding error, then post the documented problem and your own solution if you found one. |
| """Small demo of a single async request utilizing the aiohttp framework. The point is to understand what is going on.""" | |
| import aiohttp | |
| import asyncio | |
| async def main(): | |
| async with aiohttp.ClientSession() as session: | |
| # session.get() returns a context manager that can be used by `await` and `async with` | |
| _req_context_manager = session.get('http://localhost:10000') | |
| # print(_req_context_manager) |