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
alias to-timesptamp-ms="python3 -c 'import datetime, sys; s = sys.argv[1]; s = s[:-1] if s[-1] == \"Z\" else s; print(round(datetime.datetime.fromisoformat(s).replace(tzinfo=datetime.timezone.utc).timestamp() * 1000))'" | |
alias from-timesptamp-ms="python3 -c 'import datetime, sys; t = int(sys.argv[1]); print(datetime.datetime.utcfromtimestamp(t/1000).strftime(\"%Y-%m-%dT%H:%M:%S.%f\")[:-3]+\"Z\")'"from-timesptamp-ms |
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
#pragma once | |
#include "common.h" // https://github.com/oliora/habr-switches-perf-test/blob/main/common.h | |
#include <cstdint> | |
#include <string_view> | |
#include <utility> | |
#include <immintrin.h> | |
template <size_t StepSize> | |
requires((StepSize <= PageSize) |
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
# Run it like `python3 udp-send.py <detination_addr> <destination_port> [<interface_to_bind>]` | |
import socket | |
import sys | |
with socket.socket(type=socket.SOCK_DGRAM) as s: | |
if len(sys.argv) >= 4: | |
s.bind((sys.argv[3], 0)) | |
s.connect((sys.argv[1], int(sys.argv[2]))) | |
s.send(b'Hello!') |
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
# Run it like `python3 udp-receiver.py 0.0.0.0 <listening_port>` | |
import socket | |
import sys | |
with socket.socket(type=socket.SOCK_DGRAM) as s: | |
s.bind((sys.argv[1], int(sys.argv[2]))) | |
while True: | |
(data, ancdata, msg_flags, address) = s.recvmsg(1024) | |
print(f'Received "{data.decode()}", ancdata="{ancdata}", sender={address}, flags={msg_flags}') |
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
#!/usr/bin/env python3 | |
''' | |
Usage (on Mac): | |
Extract tables to clipboard. Simply paste it to Google Spreadsheets afterwards: | |
python3 extract_tables_from_pdf.py ~/Downloads/doc.pdf" --remove-eols --pages '27-30' | pbcopy | |
Extract to a file: |
OlderNewer