Skip to content

Instantly share code, notes, and snippets.

View rastr-0's full-sized avatar
🇺🇦

Roman Milko rastr-0

🇺🇦
View GitHub Profile
@rastr-0
rastr-0 / selector_demo.py
Created November 12, 2025 22:46
A simple example of selector usage in Python
import socket
import selectors
sel = selectors.DefaultSelector()
def accept_connection(server_sock):
conn, addr = server_sock.accept()
print(f"Accepted connection from {conn} | {addr}");
conn.setblocking(False);
sel.register(conn, selectors.EVENT_READ, read_data)
@rastr-0
rastr-0 / example.cpp
Created November 6, 2025 17:58
An example of the c++ class with overloaded operators
#include <iostream>
#include <utility>
#include <cmath>
using namespace std;
class Point {
private:
float x;
float y;