Skip to content

Instantly share code, notes, and snippets.

@winstr
winstr / run_container_wsl.sh
Last active November 20, 2023 01:31
Run container on WSL2
#!/bin/bash
# author: seunghyeon.me@gmail.com
# run container on wsl
# arguments
REPO="dsnw/ml:ubuntu-torch-devel"
NAME="pytorch"
CONTAINER_PATH="/home/`whoami`/containers"
DATASETS_PATH="/mnt/d/datasets"
@winstr
winstr / build_opencv.sh
Created October 6, 2023 22:55
Install OpenCV on Jetson Platform
#!/bin/bash
# OpenCV 4.8.0 Source Compile
# https://qengineering.eu/install-opencv-on-jetson-nano.html
wget https://github.com/Qengineering/Install-OpenCV-Jetson-Nano/raw/main/OpenCV-4-8-0.sh
sudo chmod 755 ./OpenCV-4-8-0.sh
./OpenCV-4-8-0.sh
rm OpenCV-4-8-0.sh
@winstr
winstr / set_rules.sh
Last active October 18, 2023 02:35
Add udev rules for cameras.
#!/bin/bash
# check dev: ex) udevadm info -a -n /dev/video0
#CSICAM0_NAME="CSI0"
#CSICAM1_NAME="CSI"
USBCAM0_NAME="ThermoCam160B"
USBCAM0_VID="1209" # vendor id
USBCAM0_PID="0160" # product id
@winstr
winstr / fan_control.sh
Last active September 27, 2023 11:28
Control a PWM Fan on Jetson series board.
#!/bin/bash
TEMP_PATH="/sys/devices/virtual/thermal/thermal_zone0/temp"
PWM_PATH="/sys/devices/pwm-fan/target_pwm"
while true; do
TEMP=$(cat $TEMP_PATH)
if [ $TEMP -lt 25000 ]; then
PWM=0
@winstr
winstr / run_l4t_ml.sh
Last active December 6, 2023 00:26
Run the Nvidia-L4T-ML Docker container
#!/bin/bash
# Check the Docker image Version
# https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-ml
NAME="r32.7.1-py3" # for Jetson Nano (Jetpack 4.6.1)
#NAME="r35.2.1-py3" # for Jetson Orin Nano (Jetpack 5.1)
DIST="nvcr.io/nvidia/l4t-ml:$NAME"
xhost +local:docker
@winstr
winstr / expand_swap_space.sh
Last active October 17, 2023 10:18
Expand swap space on Nvidia Jetson series board.
!/bin/bash
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab