Skip to content

Instantly share code, notes, and snippets.

View mcarletti's full-sized avatar

Marco Carletti mcarletti

View GitHub Profile
@mcarletti
mcarletti / uninstall_cuda_and_nvidia_drivers.sh
Last active June 21, 2019 16:49
Uninstall CUDA, NVIDIA drivers and utilities on Ubuntu (18.04)
#!/bin/bash
sudo apt remove --purge -y 'cuda*' 'nvidia-*'
sudo add-apt-repository --remove -y ppa:graphics-drivers/ppa
sudo apt update
sudo reboot
@mcarletti
mcarletti / cuda_9.0_on_ubuntu_18.04.sh
Last active July 12, 2019 13:53 — forked from Mahedi-61/cuda_11.8_installation_on_Ubuntu_22.04
cuda 9.0 complete installation procedure for ubuntu 18.04 LTS
#!/bin/bash
## This gist contains step by step instructions to install cuda v9.0 and cudnn 7.2 in ubuntu 18.04
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
@mcarletti
mcarletti / pvnet.sh
Last active September 24, 2019 09:28
Download, compile and install PVNet
#!/bin/bash
sudo apt update
# Tested on:
# ubuntu 18.04 (kernel 4.15.0-58-generic x86_64 GNU/Linux)
# gcc (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
# cuda 8.0 (/usr/local/cuda-8.0)
git clone https://github.com/zju3dv/pvnet.git
@mcarletti
mcarletti / CMakeLists.txt
Last active October 17, 2019 09:07
Simple cmake file (comments in ITA)
# ========================================================
# Assumo che la struttura del progetto sia la seguente:
#
# .
# ├── include
# │  └── engine
# │  └── ...
# ├── sources
# │  └── ...
# ├── examples
@mcarletti
mcarletti / cuda_10.0_on_ubuntu_18.04.sh
Last active October 30, 2019 11:30
cuda 10.0 installation on ubuntu 18.04 LTS
#!/bin/bash
#
# Install CUDA 10.0 on a "fresh" Ubuntu 18.04 LTS machine.
#
# update: July 2019
# author: Marco Carletti
#
# Deep Learning frameworks requirements:
# PyTorch 1.1.0 -- CUDA 10.x
# TensorFlow-pgu 1.13.x or higher -- CUDA 10.0, cuDNN 7.3
@mcarletti
mcarletti / example.desktop
Last active August 27, 2020 12:49
Minimal description and example of a Ubuntu launcher file, aka .desktop file
[Desktop Entry]
Name=Name of Application
GenericName=Application
GenericName[it]=Applicazione
Comment=Cool app, very useful
Comment[it]=Applicazione molto utile e intrigante
Categories=cat1;cat2;...
Keywords=kw1;kw2;...
Encoding=UTF-8
Exec=/path/to/executable
@mcarletti
mcarletti / ubuntu_setup.sh
Last active May 4, 2023 13:26
Setup Ubuntu after fresh install.
#!/bin/sh
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
echo "Not running as root"
exit 1
fi
apt update
apt upgrade -y
@mcarletti
mcarletti / samsung_a3_camera_calib_front.yml
Created February 25, 2020 16:10
Samsung A3 front camera calibration using OpenCV (ChArUco board)
# Samsung A3
# Front camera: 8 MP, f/2.4, 31mm (standard), AF
width: 4128
height: 2322
focal: 3.6
rms: 1.6153361028439144
camera_mtx:
@mcarletti
mcarletti / build_opencv.sh
Last active February 8, 2024 15:43
Compile OpenCV from source
#!/bin/bash
# Tested on
# ------------------------------
# OS Ubuntu 18.04
# Platform x86_64, aarch64
# Python 3.6
if [ $# != 1 ]; then
echo -e "Usage:\n\t./build_opencv.sh VERSION\n\nExample:\n\t./build_opencv.sh 4.2.0"
def load_nv12_as_bgr(filename, shape, dtype=np.uint8):
with open(filename, "rb") as fp:
data = fp.read()
image = np.frombuffer(data, dtype=dtype).reshape(shape)
image = cv2.cvtColor(image, cv2.COLOR_YUV2BGR_NV12)
return image