MareArts ANPR mobile app

Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

4/17/2025

.screenrc setup for better usage

 

.screenrc

code ~/.screenrc or vim or nano

and put this 

# Current settings for scrolling and encoding
termcapinfo xterm* ti@:te@
defutf8 on
term screen-256color
defscrollback 10000
encoding utf8

# Add these lines for better keyboard handling
bindkey -k ku stuff \033[A
bindkey -k kd stuff \033[B
bindkey -k kl stuff \033[D
bindkey -k kr stuff \033[C

# Allow alternate screen
altscreen on

# Set terminal to xterm-256color for better compatibility
terminfo xterm-256color hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l

# Make bash history work properly
shell -$SHELL

#study.marearts.com



detach or recreate screen

Thank you.

3/06/2024

How to stop docker under Linux

 I can stop docker after put two commend. 

> sudo systemctl stop docker

[sudo] password for mare: 

Warning: Stopping docker.service, but it can still be activated by:

  docker.socket

> sudo systemctl stop docker.socket


I hope it's helpful to you.

Thank you.

🙇🏻‍♂️

2/19/2023

How to Install OpenCV 4.7 with CUDA, cuDNN, TBB, CUDA Video Codec, and Extra Modules in Linux

 


refer to bash code


.

#!/bin/bash

# Install dependencies
sudo apt-get update
sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev
sudo apt-get install libcanberra-gtk-module libcanberra-gtk3-module

# Install CUDA 11
wget https://developer.download.nvidia.com/compute/cuda/11.4.0/local_installers/cuda_11.4.0_470.57.02_linux.run
sudo sh cuda_11.4.0_470.57.02_linux.run --silent --toolkit --override
echo 'export PATH=/usr/local/cuda-11.4/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-11.4/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc

# Download and extract TBB
wget https://github.com/oneapi-src/oneTBB/releases/download/v2022.0.0/oneapi-tbb-2022.0.0-lin.tgz
tar -xf oneapi-tbb-2022.0.0-lin.tgz
sudo cp -r oneapi-tbb-2022.0.0/lib/* /usr/local/lib/
echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc

# Download and extract OpenCV 4.7 and OpenCV extra modules
wget https://github.com/opencv/opencv/archive/4.7.0.zip
unzip 4.7.0.zip
cd opencv-4.7.0

wget https://github.com/opencv/opencv_contrib/archive/4.7.0.zip
unzip 4.7.0.zip

# Build and install OpenCV 4.7 with CUDA, cuDNN, TBB, CUDA video codec, and OpenCV extra modules
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.7.0/modules -D WITH_CUDA=ON -D WITH_TBB=ON -D WITH_NVCUVID=ON -D WITH_GSTREAMER=ON -D WITH_GSTREAMER_0_10=OFF -D WITH_LIBV4L=ON -D WITH_CUDNN=ON -D CUDA_ARCH_BIN=7.5 ..
make -j$(nproc)
sudo make install
echo 'export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH' >> ~/.bashrc
source ~/.bashrc

# Compile and run the sample code
cd ../../
wget https://raw.githubusercontent.com/spmallick/learnopencv/master/Averaging4kVideo/Averaging4kVideo.cpp
g++ Averaging4kVideo.cpp -o Averaging4kVideo `pkg-config --cflags --libs opencv4`
./Averaging4kVideo

..



thank you.

🙇🏻‍♂️

www.marearts.com

4/29/2021

Install python 3.8 on Linux

 

Following below step:

-------------

wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz

tar xvf Python-3.8.3.tgz

cd Python-3.8*/

./configure --enable-optimizations

make altinstall

-------------



1/29/2021

Importerror: libgl.so.1: cannot open shared object file: no such file or directory opencv error

Try this one first:

pip install opencv-python--headless


or 

install follow in case centos or aws linux docker

RUN yum install whatprovides libGL.so.1 -y

install follow in case linux docker

ENV TZ=Europe/Minsk
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get install libgtk2.0-dev -y

 

Thank you, Good luck!

12/10/2020

linux screen command list in summary

*create screen
screen -S name

*leave with alive
Ctrl a, d

*enter screen 
screen -r name 

*kill specific screen
screen -S name -X quit

*show screen list
screen -ls

*detach specific screen

screen -d name


*kill all screen
killall screen

11/09/2018

How to mount extra hdd permanently

> sudo -I blkid
/dev/sdb1: UUID="0687f976-6efe-4ac5-88dd-8fd863f8b8bf" TYPE="ext4" PARTUUID="1569f982-01"/dev/sda1: LABEL="cloudimg-rootfs" UUID="8ae3d910-2d2a-492d-8667-d0fa24e4d357" TYPE="ext4" PARTUUID="05ae307a-01"/dev/sdc1: UUID="e8abbf34-2cb2-471f-bac6-2a5caec81ad8" TYPE="ext4" PARTUUID="4c4db30a-01"




check uuid that you want to mount
>sudo nano /etc/fstab
Add this string end of file, but uuid must be your value, and ext4 also should be same with blkid information

UUID=e8abbf34-2cb2-471f-bac6-2a5caec81ad8 /media/datadisk ext4 defults,nofail    0       2

Thank you.



12/31/2017

Making virtualenv using mkvirtualenv or virtualenv, simple command memo.


- create virtual env wrapper & deactivate
mkvirtualenv env-py2 -p python2 #(or python3)
workon env-py2
deactivate

- create virtual env & deactivate
sudo pip install virtualenv
virtualenv env
sourse env/bin/activate
source deactivate

- delete virtual env
rmvirtualenv envname

- virtualenv dependencies save and install
#On the first, save
pip freeze > requirements.txt
#On the second, install(note! after activating target env)
pip install -r requirements.txt

-show all virtualenv names
lsvirtualenv -l

- PyCharm virtualenv wrapper setting
We have to set directory path manually in preference setting page.
The path is like this in my case.
And then you can select this virtualenv on run/debug configuration.



1/05/2016

(lucky tip) linux opencv+cuda cmake setting and build error ->nvcc fatal compute_11

About nvcc fatal compute_11 error
when build linux(ubuntu) after opencv + cuda setting using cmake

Try change cmake setting.
Cann't you see this option check Advanced box.

CUDA_GENERATION=Kepler
Add 3.2 in CUDA_ARCH_BIN

CUDA_ARCH_BIN = 3.2

12/30/2015

How to run *.run file in Linux ? (simple tip)


Just change mode
and run!
'./' means sh command


# chmod a+x install_test.run
# ./install_test.run


Linux is not easy to me.....