Skip to content

Instantly share code, notes, and snippets.

@adujardin
adujardin / network_scanner.py
Created November 10, 2025 16:59
Network scanner script
#!/usr/bin/env python3
"""
Network Scanner - Scan your local network for devices
Displays IP addresses, MAC addresses, and checks for web ports (80/443)
Supports filtering by MAC address vendor prefix
Auto-detects CIDR from network interface configuration
Smart interface detection (skips Docker, loopback, virtual interfaces)
"""
import socket
@adujardin
adujardin / README.md
Last active May 19, 2025 10:44
Debugging cuda cheat sheet

Debugging CUDA exe

  1. Set CUDA as Synchronous mode: export CUDA_LAUNCH_BLOCKING=1
  2. Use CUDA GDB :
/usr/local/cuda/bin/cuda-gdb --arg foo arg1 arg2

Enable GDB option :

@adujardin
adujardin / download_zed_models.py
Last active June 10, 2025 13:38
Download ZED SDK models
import os
import argparse
import requests
import sys
def print_help():
help_text = """
Download ZED SDK AI models from Stereolabs.
Usage:
@adujardin
adujardin / BinaryVectorStream.hpp
Created March 8, 2024 10:49
fstream like interface for vector of uint8_t
#include <iostream>
#include <fstream>
#include <vector>
#include <cstdint>
class BinaryVectorStream {
private:
std::vector<uint8_t>& data;
size_t position;
@adujardin
adujardin / yolov8_trt.py
Last active February 26, 2024 17:24
YOLOv8 TensorRT Python
# From https://docs.ultralytics.com/fr/integrations/tensorrt/#installation
from ultralytics import YOLO
import os
import cv2
# Export the model to TensorRT format, this will take a long time but should be done only once (per GPU)
if not os.path.isfile('yolov8n.engine'):
# Load the YOLOv8 model
model = YOLO('yolov8n.pt')
@adujardin
adujardin / tsukuba_depth_to_disp.py
Created October 30, 2023 17:27
Simple conversion function to get precise disparity from depth data from NewTsukubaStereoDataset
import cv2
import numpy as np
calib_fx=615
calib_baseline=10
def depth_to_disp(depth_filename, disp_filename):
cv_file = cv2.FileStorage(depth_filename, cv2.FILE_STORAGE_READ)
matrix = cv_file.getNode("depth").mat()
cv_file.release()
@adujardin
adujardin / setup_mimalloc.sh
Last active July 19, 2023 15:04
Install mimalloc
# https://github.com/microsoft/mimalloc
VERSION="1.8.2"
wget https://github.com/microsoft/mimalloc/archive/refs/tags/v${VERSION}.zip
unzip v${VERSION}.zip
cd mimalloc-${VERSION}
mkdir build ; cd build ; cmake .. ; make -j ; sudo make install
cd ../../
rm -rf v${VERSION}.zip mimalloc-${VERSION}
sudo ln -s /usr/local/lib/libmimalloc.so /usr/lib/libmimalloc.so
@adujardin
adujardin / dataset_cleanup.py
Created July 18, 2023 14:26
Remove folder matching name recursively and file with specific extension
import os
import shutil
from concurrent.futures import ThreadPoolExecutor
def remove_file(file_path):
try:
os.remove(file_path)
print(f"File '{file_path}' removed successfully.")
except Exception as e:
print(f"Failed to remove file '{file_path}': {e}")
@adujardin
adujardin / create_ap.md
Last active June 15, 2023 14:41
Create WiFi AP Linux
@adujardin
adujardin / print_linux_hw_info.sh
Last active January 27, 2023 15:53
Simple script to get some info about a linux machine
#!/bin/bash
host=$(cat /etc/hostname)
echo "PC Name: ${host}"
cpu=$(cat /proc/cpuinfo | grep "model name" | head -1 | sed "s/model name : //")
echo "CPU: ${cpu}"
motherboard=$(sudo dmidecode -t 2 | grep "Product Name" | sed "s/ Product Name: //")
echo "Motherboard: ${motherboard}"