Skip to content

Instantly share code, notes, and snippets.

@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 / 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_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 / repack_tensorRT.sh
Last active July 2, 2021 15:19
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 / 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 / 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 / get_pyzed.py
Last active February 19, 2020 17:16
Automatically download pyzed package from the detected ZED SDK, CUDA and OS version
import os
import platform
import sys
import re
import urllib.request
ZED_SDK_MAJOR = ""
ZED_SDK_MINOR = ""
CUDA_STR = ""
@adujardin
adujardin / discover_ip_slack.sh
Last active May 17, 2021 12:21
Explore local network IP and output it on slack (PC name / IP / Vendor)
# Should be run as root
Ips=$( nmap -sP 192.168.*.* | sed '/Host is up/d' | sed 's/.localdomain//' | sed 's/Nmap scan report for *//' | sed '/Nmap done/d' | sed 's/MAC Address: ..:..:..:..:..:.. //' | tr \(\) \* | paste -d ' ' - - | sed '/Starting Nmap/d' )
# Check the diff between current run and previous (should be run in a cron every hour or something)
echo $Ips > current
if ! cmp current old >/dev/null 2>&1; then
curl -X POST -H 'Content-type: application/json' --data '{"text": "---------------------\n\n\n'"${Ips}"'" }' https://hooks.slack.com/services/<INSERT_ACTUAL_SLACK_URL_HERE>
mv current old
fi
import argparse
import torch
import torchvision
import shutil
# https://github.com/vita-epfl/openpifpaf/blob/master/openpifpaf/export_onnx.py
try:
import onnx
import onnx.utils
except ImportError:
@adujardin
adujardin / clean_jetson.sh
Last active January 10, 2025 05:03
Script to remove unnecessary stuffs from the Jetson to save disk space (WIP)
# https://elinux.org/Jetson/FAQ/BSP/RootFS_Reduction#Remove_installed_deb_packages
## Step 1, safe
sudo apt update
sudo apt autoremove -y
sudo apt clean
sudo apt remove thunderbird libreoffice-* -y
## Step 2, still safe but not recommended for dev use
# samples