Skip to content

Instantly share code, notes, and snippets.

View vrbadev's full-sized avatar
🇺🇦

Vojtěch Vrba vrbadev

🇺🇦
View GitHub Profile
@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 / 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 / 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 / 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 / sigint_lambda_handler.py
Created May 22, 2024 14:36
Python termination signal handler using a lambda and a global variable
import signal
if __name__ == "__main__":
terminated = False
signal.signal(signal.SIGINT, lambda sig, frame: globals().update(terminated=True))
while not terminated:
# do something ...
@vrbadev
vrbadev / rosbag_extractor.py
Last active May 22, 2024 14:37
ROS-less python rosbag topic extraction (using rosbags library)
from pathlib import Path
from rosbags.highlevel import AnyReader
from contextlib import nullcontext
from tqdm import tqdm
# aux function to get a list of all rosbag topic names
def rosbag_topics(bag_path):
with AnyReader([Path(bag_path)]) as reader:
return reader.topics
@vrbadev
vrbadev / get_bitstamp_ohlc_data.py
Last active May 29, 2024 18:33
Simple Python script which gathers all available Bitstamp OHLC data for selected trading pair and interval.
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 23 14:04:42 2023
@author: Vojtech Vrba ([email protected])
Simple Python script which gathers all available Bitstamp OHLC data for selected trading pair and interval.
The data is stored in a new CSV file / only new data is appended to the end of an existing CSV file.
"""
import datetime as dt
@vrbadev
vrbadev / Debian_12_ROS_Noetic_Installation.md
Last active February 14, 2025 23:39
[TUTORIAL] How to install ROS Noetic on Debian 12 Bookworm

Tutorial: How to install ROS Noetic on Debian 12 Bookworm

This is a short tutorial on building ROS Noetic in the Debian 12 ("bookworm") fresh-install environment. There are several packages not available (yet) from the official apt repositories, which have to be either built from source or installed from older Debian 11 ("bullseye") repository DEB packages. Several packages also have to be downgraded to maintain compatibility.

Preparation

  1. Add ROS repository for older Debian 10 ("buster") to our apt sources list:
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu buster main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
@vrbadev
vrbadev / debian_from_ros_pkg.md
Created May 24, 2023 08:44 — forked from awesomebytes/debian_from_ros_pkg.md
How to create a debian from a ROS package
@vrbadev
vrbadev / fpgaint.c
Last active November 14, 2022 13:43
Cyclone V HPS - Linux kernel driver for non-blocking polling of FPGA-to-HPS interrupts (f2h_irq0 and f2h_irq1) (tested with linux-socfpga v5.19)
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/init.h>
#include <linux/device.h>