Skip to content

Instantly share code, notes, and snippets.

@adujardin
adujardin / gitlab_run_setup.sh
Last active November 3, 2022 10:29
Setup gitlab runner docker
#!/usr/bin/env bash
set -e -x
SILENT=0
for arg in "$@"; do
arg_l=$(echo "$arg" | tr '[:upper:]' '[:lower:]')
if [ "$arg_l" == "silent" ]; then
SILENT=1
fi
@adujardin
adujardin / useful_commands.sh
Last active October 25, 2021 13:45
Memo for random useful bash commands
# Search recursively text in files
grep -rIn "My text" ../path/to/folder/
# Replace recursively matching string in all text files
find ../path/to/folder/ -type f -exec sed -i 's/My string to replace/My new string/g' {} +
# Git merge without issues from EOL (win <-> unix for instance)
git merge -s recursive -Xignore-space-at-eol my_branch
# ccmake setup ubuntu
@adujardin
adujardin / repack_tensorRT.sh
Last active August 12, 2025 12:57
This script takes a path as an input, a folder containing all TensorRT archives (Windows and Linux), with samples, dataset... The goal is to repack each archive into only lib + headers.
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo "Please provides absolute path with all the TensorRT archives"
fi
arrayName=($(ls "${1}"/TensorRT*.*))
working_folder="${1}/repack"
mkdir -p "${working_folder}"
@adujardin
adujardin / cmake_apt_update.sh
Last active June 25, 2020 22:14
Update cmake Ubuntu
#!/usr/bin/env bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# https://apt.kitware.com/
if [ -n "$(uname -a | grep Ubuntu)" ]; then
apt-get update ; apt-get install lsb-release apt-transport-https ca-certificates gnupg software-properties-common wget -y
@adujardin
adujardin / compile_darknet.sh
Last active June 12, 2019 10:38
nvcc issue repo script
# docker run -it nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04 bash
# then inside the image :
apt update ; apt install git cmake libopencv-dev -y
git clone https://github.com/AlexeyAB/darknet.git ; cd darknet
git checkout 378d49e1c33cc8c064cb27c99815de0698b2ad93
mkdir build_cmake; cd build_cmake; cmake ..
make -j4
@adujardin
adujardin / cmake_linux_install.sh
Created March 19, 2019 14:26
Install a custom version of cmake on Linux
#!/bin/bash
version="3.14.0"
linux_name="cmake-${version}-Linux-x86_64"
url="https://github.com/Kitware/CMake/releases/download/v${version}/${linux_name}.tar.gz"
wget ${url} -O /tmp/cmake.tar.gz -q --show-progress
cd /tmp/
tar -xf cmake.tar.gz
sudo cp -r "${linux_name}/bin" /usr/
@adujardin
adujardin / filter_yolo_coco_class.sh
Last active September 10, 2021 11:48
Filter yolo coco class with class id remapping
#!/bin/bash
# Assume coco folder from YOLO
coco_original_path="/path/to/coco"
coco_new_path="/path/to/coco_customclass"
mkdir -p ${coco_new_path}
cp -R ${coco_original_path}/annotations ${coco_new_path}/
cp -R ${coco_original_path}/common ${coco_new_path}/
@adujardin
adujardin / multi_zed.py
Created September 13, 2018 09:02
Python sample to open 2 ZED with the ZED SDK (https://github.com/stereolabs/zed-python)
import cv2
import pyzed.camera as zcam
import pyzed.types as tp
import pyzed.core as core
import pyzed.defines as sl
def main():
print("Running...")
init = zcam.PyInitParameters()
@adujardin
adujardin / ccache_setup.sh
Created August 23, 2018 13:19
ccache setup ubuntu
#https://askubuntu.com/a/470636/609717
# Install package
sudo apt install -y ccache
# Update symlinks
sudo /usr/sbin/update-ccache-symlinks
# Prepend ccache into the PATH
echo 'export PATH="/usr/lib/ccache:$PATH"' | tee -a ~/.bashrc