Skip to content

Instantly share code, notes, and snippets.

@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}"
@adujardin
adujardin / upgrade_jetpack.sh
Created November 3, 2022 10:36
On device jetpack upgrade for jetson (from L4T 32.6 -> 32.7)
#!/usr/bin/env bash
set -x
LT4_MAJOR=32
LT4_MINOR_OLD=6
LT4_MINOR=7
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
@adujardin
adujardin / bulk_reboot_linux_ssh.sh
Created September 23, 2022 08:42
Script to reboot/run common command(s) to a list of linux machine through ssh
targets=(
192.168.1.83 # sl-u18-hlc1
192.168.2.253 # sl-nano-run5-46
192.168.3.220 # sl-tx2nx-run1-jp46
192.168.2.246 # sl-nx-run1-jp46
192.168.3.73 # sl-run-multicam
)
# all targets have the same user and password, this can be skipped if the ssh key is already registered
user="<user>"
pass="<password>" # security issue
@adujardin
adujardin / yolov7_val.sh
Last active July 18, 2022 09:41
yolov7_val.sh
#docker run --gpus=all -it -v /:/host/ nvcr.io/nvidia/pytorch:22.02-py3
host_folder="/host/tmp/yolov7_results.txt"
rm ${host_folder}
git clone https://github.com/WongKinYiu/yolov7
cd yolov7
pip install -qr requirements.txt
pip uninstall opencv-python
pip install opencv-python-headless==4.4.0.40
@adujardin
adujardin / for_sl_mat.cpp
Created June 22, 2022 08:47
Efficient CPU iterations over sl::Mat 32F and 8UC4
for (int y = 0; y < height; y++) {
// line pointer
float * ptr_disp = (float *) (disp.getPtr<uchar>(sl::MEM::CPU) + y * disp.getStepBytes(sl::MEM::CPU));
uchar4* ptr_image = (uchar4*) (img.getPtr<uchar>(sl::MEM::CPU) + y * img.getStepBytes(sl::MEM::CPU));
for (int x = 0; x < width; x++) {
float px_disp = ptr_disp[x];
uchar4 px = ptr_image[x];
}
}
@adujardin
adujardin / UnityPeopleSansPeople.md
Created June 2, 2022 11:56
Unity-Technologies/PeopleSansPeople for kp training
@adujardin
adujardin / mot17det_to_yolo.py
Last active May 5, 2022 08:23
MOTDet17 to Yolov5 (people class)
# wget https://motchallenge.net/data/MOT17Det.zip
# unzip MOT17Det.zip
# rm -rf MOT17Det/test/
import configparser
import os
import shutil
import numpy as np
def get_metadata_from_seqinfo(seqinfo_path):
@adujardin
adujardin / wifi_linux_driver.sh
Created December 13, 2021 14:55
wifi_linux_driver.sh
# from https://community.tp-link.com/en/home/forum/topic/208022
# tested on Ubuntu 20.04 with a TP-Link AC1300
git clone https://github.com/cilynx/rtl88x2bu.git
cd rtl88x2bu
VER=$(sed -n 's/\PACKAGE_VERSION="\(.*\)"/\1/p' dkms.conf)
sudo rsync -rvhP ./ /usr/src/rtl88x2bu-${VER}
sudo dkms add -m rtl88x2bu -v ${VER}
sudo dkms build -m rtl88x2bu -v ${VER}
sudo dkms install -m rtl88x2bu -v ${VER}