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
# %% [markdown] | |
# # Channel Estimation | |
# | |
# - The multi-path channel acts as a filter on the transmitted information. | |
# - The channel impulse response **CIR** has to be estimated to enable the detection algorithms, **DFE** and **MLSE** to estimate the transmitted block or sequence of symbols. | |
# - This is made possible by transmitting a sequence of known symbols, known as **pilot symbols** or **training symbols**, in the center of the data block. | |
# - Assuming the **CIR** is time-invariant for the duration of a data block, the **CIR** can be estimated from the **pilot symbols** using a process called **least squares** or **LS** estimation. | |
# | |
# \begin{equation} | |
# S = [s_1, s_2, \dots, p_1, p_2, \dots, p_p, \dots, s_{N-1}, s_{N}] |
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 time | |
import random | |
import asyncio | |
def randomSleep(): | |
# Blocking sleep function | |
random_delay = random.uniform(0, 1) | |
time.sleep(random_delay) | |
async def randomAsyncSleep(): |
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
from typing_extensions import TypedDict | |
from typing import Optional | |
class NodeDict(TypedDict): | |
id: str | |
value: int | |
parent: Optional['NodeDict'] # No error anymore | |
parent_node = NodeDict( | |
id='parent_node_id', |
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 re | |
pattern = r'(?i)@remindMe\s*(?:(?:(\d+)\s*years?)?\s*)?(?:(\d+)\s*months?)?\s*(?:(\d+)\s*weeks?)?\s*(?:(\d+)\s*days?)?\s*(?:(\d+)\s*hours?)?\s*(?:(\d+)\s*minutes?)?' | |
tests: list[str] = list([ | |
"@remindMe 3 years 2 months 1 weeks 1 day", | |
"@remindMe 6 months 2 days", | |
"@remindMe 7 months 1 day", | |
"@remindMe 2 weeks", | |
"@remindMe 1 day", |
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
// ==UserScript== | |
// @name Remove techhub.social logo from the page | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Remove the annoying logo from the webpage. | |
// @author https://techhub.social/@Stark9837 | |
// @match https://techhub.social/* | |
// @grant none | |
// ==/UserScript== |
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
from itertools import accumulate | |
from timeit import default_timer as timer | |
if __name__ == "__main__": | |
custom_accumulate_start = timer() | |
myList = range(0, 10000, 2) | |
myTotal = 0 | |
myAccumulation = list() | |
for myItem in myList: |
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
list_a = [1, 2020, 70] | |
list_b = [2, 4, 7, 2000] | |
list_c = [3, 70, 7] | |
for a in list_a: | |
for b in list_b: | |
for c in list_c: | |
if a + b + c == 2077: | |
print(a, b, c) |
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
def handleMastodonExceptions(func) -> Callable: | |
""" | |
This is an exception handler that can be used as a wrapper via a decorator to handle Mastodon.py exceptions. | |
""" | |
def wrapper(self, *args, **kwargs): | |
try: | |
result = func(self, *args, **kwargs) | |
return result | |
except MastodonServerError as e: | |
logging.critical(f"MastodonServerError: {e}") |
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
from typing import Any, Dict | |
import yaml | |
from collections import UserDict | |
class ConfigAccessor(UserDict): | |
def __init__(self, file_name: str) -> None: | |
super().__init__() | |
self.file_name = file_name | |
try: |
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
def copy_missing_keys(source_dict, destination_dict): | |
for key, value in source_dict.items(): | |
if key not in destination_dict: | |
destination_dict[key] = value | |
# Sample dictionaries | |
dict1 = {'key1': 42, 'key2': 10, 'key3': 5} | |
dict2 = {'key2': 15, 'key4': 23} | |
# Copy missing keys and values from dict1 to dict2 |
NewerOlder