Skip to content

Instantly share code, notes, and snippets.

View vrbadev's full-sized avatar
🇺🇦

Vojtěch Vrba vrbadev

🇺🇦
View GitHub Profile
@vrbadev
vrbadev / rosbags_info.py
Last active June 1, 2024 17:31
A ROS-independent script which simulates the ROS command "rosbag info" functionality.
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 1 17:49:53 2024
@author: Vojtech Vrba ([email protected])
Required extra packages: rosbags
"""
from pathlib import Path
from rosbags.highlevel import AnyReader
@vrbadev
vrbadev / evt3_to_csv.py
Last active June 25, 2024 08:55
Script for extraction of events compressed in RAW file with EVT3 format to a CSV file. This script is in pure python and does not depend on any additional packages (optionally tqdm).
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 24 18:16:30 2024
@author: Vojtech Vrba ([email protected])
Script for extraction of events compressed in RAW file with EVT3 format to a CSV file.
References:
- https://docs.prophesee.ai/stable/data/encoding_formats/evt3.html#chapter-data-encoding-formats-evt3
"""
@vrbadev
vrbadev / client.py
Created August 20, 2024 08:49
Simple Python socket server echoing all messages back to connected clients, keeping track of closed client threads
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 20 09:14:55 2024
@author: Vojtech Vrba ([email protected])
Simple socket client.
Connects to a server with an IP given by the current SSH connection, and with a port 12345.
Sends a sample message every 1 second and prints the server's response.
"""
@vrbadev
vrbadev / async_callback_queue_sync.py
Last active February 11, 2025 23:13
Python async callback synchronization using queues
import queue
import threading
import time
import uuid
# Create two queues: one for requests and one for responses
request_queue = queue.Queue()
response_queue = queue.Queue()
# Callback function that puts a request into the request queue and waits for the response
@vrbadev
vrbadev / quartic_roots.cpp
Last active October 10, 2025 13:29
Fast and simple quartic polynomial roots calculation implemented in plain C++
template<typename T=double>
std::array<std::complex<T>, 4> solve_quartic_roots(std::complex<T> c4, std::complex<T> c3, std::complex<T> c2, std::complex<T> c1, std::complex<T> c0) const {
c3 /= c4; c2 /= c4; c1 /= c4; c0 /= c4;
const T eps = std::numeric_limits<T>::epsilon();
const T inv2 = 0.5, inv3 = 1.0/3.0, inv27 = 1.0/27.0;
auto a4q = 0.25 * c3;
auto a4q2 = a4q * a4q;
auto a4q4 = a4q2 * a4q2;
auto p = 3.0 * a4q2 - inv2 * c2;
auto q = c3 * a4q2 - c2 * a4q + inv2 * c1;