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 mmap | |
import timeit | |
def test_file_memory_mapping() -> None: | |
with open('large_file.txt', 'r+b') as f: | |
mmapped_file = mmap.mmap(f.fileno(), 0) | |
# Random access to different parts of the file | |
for i in range(0, len(mmapped_file), 1000): | |
mmapped_file[i : i + 10] |
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
[tool.ruff] | |
target-version="py312" | |
line-length = 120 | |
show-fixes = true | |
# Exclude a variety of commonly ignored directories. | |
exclude = [ | |
".direnv", | |
".eggs", | |
".git", | |
".mypy_cache", |
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 time | |
import timeit | |
from functools import lru_cache | |
@lru_cache(maxsize=32) | |
def long_process(user_id: int) -> int: | |
time.sleep(0.01) | |
return 1 |
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 typing import Any, TypedDict | |
from sqlalchemy import Column, Integer, String, and_, create_engine, func, select | |
# from sqlalchemy.dialects.postgresql import JSONB | |
from sqlalchemy.dialects.sqlite import JSON | |
from sqlalchemy.orm import declarative_base, sessionmaker | |
class Customer(TypedDict): | |
email: str | |
phone: str |
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
#h264 | |
ffmpeg.exe -init_hw_device qsv=hw -filter_hw_device hw -i .\out.mp4 -movflags +faststart -c:v h264_qsv -load_plugin h264_hw -global_quality 25 -max_muxing_queue_size 1024 -c:a copy aa_tope.mp4 | |
#h265 | |
ffmpeg.exe -init_hw_device qsv=hw -filter_hw_device hw -i .\out.mp4 -movflags +faststart -c:v hevc_qsv -load_plugin hevc_hw -global_quality 25 -max_muxing_queue_size 1024 -c:a copy aa_tope.mp4 |
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 functools import reduce | |
import datetime | |
def time_it(func, numbers, *args): | |
start_t = datetime.datetime.now() | |
for i in range(numbers): | |
func(args[0]) | |
print (datetime.datetime.now()-start_t) |
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 abc import abstractmethod | |
from typing import TypeVar, Generic, get_args, Type, List | |
class Fruit: | |
@abstractmethod | |
def fruit_name(self) -> str: | |
raise NotImplementedError | |
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
INTEL i7 10710U CML | |
https://en.wikichip.org/wiki/intel/microarchitectures/comet_lake | |
Intel® Wi-Fi 6 AX201 160MHz | |
--------------------------- | |
https://www.intel.es/content/www/es/es/products/wireless/wi-fi-6-series/wi-fi-6-ax201.html | |
https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi | |
https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi/iwlwifi-qu-48.13675109.0.tgz | |
sudo cp iwlwifi-*.ucode /lib/firmware | |
sudo modprobe iwlwifi |
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
sudo chmod 600 .ssh/* | |
chown -R $USER:$USER .ssh | |
sudo apt-add-repository -y ppa:teejee2008/ppa | |
sudo apt-get install fonts-symbola | |
sudo apt install s-tui i7z | |
fc-cache -f -v |
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
# connect wifi from terminal | |
nmtui | |
kate /etc/pacman.conf | |
[Add or remove comment color] | |
# yay repository tool | |
git clone https://aur.archlinux.org/yay.git | |
cd yay | |
makepkg -si |
NewerOlder