Showing posts with label Linux.Developer. Show all posts
Showing posts with label Linux.Developer. Show all posts

Tuesday, June 06, 2023

Ubuntu 18 OpenGL compilation issues

1) 

In file included from main.cpp:8:0:
gluvi.h:10:10: fatal error: GL/glut.h: No such file or directory
#include <GL/glut.h> // ...when everyone else puts it here?
         ^~~~~~~~~~~

$ sudo apt-get install freeglut3-dev

2)

util.h: In function ‘double randhashd(unsigned int)’:
util.h:259:33: error: UINT_MAX’ was not declared in this scope
{ return randhash(seed)/(double)UINT_MAX; }

#include <climits>

3)

array1.h: In constructor ‘Array1<T>::Array1(long unsigned int, const T*, long unsigned int)’:
array1.h:124:12: error: memcpy’ is not a member of ‘std
      std::memcpy(data, data_, n*sizeof(T));

#include <cstring>


4) Does not find/recognize libGL

fincahuanaco@pisces:~/DRIVE/Research23/viscosity$ g++ testgl.cpp -lglut -lGLU -L/usr/lib -lGL
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status

#Check symbolic link

$ file /usr/lib/x86_64-linux-gnu/libGL.so 
/usr/lib/x86_64-linux-gnu/libGL.so: broken symbolic link to libGL.so.1.0.0 
 
$ file /usr/lib/x86_64-linux-gnu/libGL.so.1.7.0 #this is right file
/usr/lib/x86_64-linux-gnu/libGL.so.1.7.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped

#Update libGL link, first go to directory and update

$ cd /usr/lib/x86_64-linux-gnu
$ sudo ln -s libGL.so.1.7.0 libGL.so

#back to source directory and try again

fincahuanaco@pisces:~/DRIVE/Research23/viscosity$ g++ testgl.cpp -lglut -lGLU -lGL            
fincahuanaco@pisces:~/DRIVE/Research23/viscosity$ ./a.out

References:

[1] First OpenGL code http://www.codebind.com/linux-tutorials/install-opengl-ubuntu-linux/




Wednesday, April 12, 2023

Jetson Wifi issues

#Alternative to wpa_supplicant

Creating connection(important don't remove --):

$ nmcli connection add type wifi con-name "myconname" ifname wlan0 ssid "eduroam" -- wifi-sec.key-mgmt wpa-eap 802-1x.eap ttls
 802-1x.phase2-auth mschapv2 802-1x.identity "USERNAME" 
$ sudo --ask nmcli c up myconname 
 

 

 

$ ls /etc/NetworkManager/system-connections  #show connections
$ cat /etc/NetworkManager/system-connections/myconname #show file connection 
$ nmcli con show myconname  #show connection detailed

Error 1:

password for '802-1x.identity' not given in 'passwd-file' 

Solution 1:

$ vi mypassfile  #add next line with pass value
802-11-wireless-security.psk:mypassvalue

$ nmcli con up <myconname> passwd-file <mypassfile>



References:

[1] Single connection https://www.linuxfordevices.com/tutorials/ubuntu/connect-wifi-terminal-command-line

[2] https://vessokolev.blogspot.com/2018/08/using-nmcli-to-create-8021x-eap-ttls.html

 




 

 

Monday, April 10, 2023

Python - Creating virtual environments

Install pip if it doesn't exist


$curl -O https://bootstrap.pypa.io/get-pip.py

$python3 get-pip.py --user

$python3 -m pip list

$python3 -m pip install tensorflow --no-cache-dir  #for space issue
 

Error during execution of: python3.8 -m venv myenv

Error: Command '['/path/to/desired/env/bin/python3.8', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

Solution: Create a virtual environment using a especific python version

$virtualenv --python=$(which python3.7) envtf4p37


 

Thursday, April 06, 2023

Proxy list and tools

 

 

Tools:

[1] https://hidemy.name/en/proxy-checker

[2] Listing proxies by country https://www.proxynova.com/proxy-server-list/country-us

Tuesday, March 28, 2023

Jetson Nano and Tensorflow 2.4 in Python3.6

 

References:

[1] https://qengineering.eu/install-tensorflow-2.4.0-on-jetson-nano.html

[2] Lite https://qengineering.eu/install-tensorflow-2-lite-on-jetson-nano.html

[3] Install bazel https://github.com/jkjung-avt/jetson_nano/blob/master/install_bazel-3.1.0.sh

Linux verify disk activities

 

 

$ sudo apt-get install iotop

$ sudo iotop -a
$ sudo iotop -oPa -d 2  #more specific
 

$ iostat  #activity by sda, sdb, etc.
 

jbd2 is a kernel thread that updates the filesystem journal.

 

References:

[1] Reduce firefox disk access https://gist.github.com/gagarine/5cf8f861abe0dd035b7af19e4f691cd8

[2] Monitoring disk activity(htop) https://askubuntu.com/questions/276669/how-to-monitor-disk-activity

Get create/birth date from files

$ stat wakeup.txt  #get the inode

$ df -h wakeup.txt #get device name sdxy

$ sudo debugfs -R 'stat <586205>' /dev/sda1

Output:

Inode: 586205   Type: regular    Mode:  0664   Flags: 0x80000
Generation: 1277687204    Version: 0x00000000:00000001
User:  1000   Group:  1000   Size: 31
File ACL: 0    Directory ACL: 0
Links: 1   Blockcount: 8
Fragment:  Address: 0    Number: 0    Size: 0
ctime: 0x615eed87:dba39c9c  -- Thu Oct  7 09:52:23 2021
atime: 0x64231159:334e6b48  -- Tue Mar 28 13:10:01 2023
mtime: 0x615eed87:dba39c9c  -- Thu Oct  7 09:52:23 2021
crtime: 0x615eed87:dba39c9c -- Thu Oct  7 09:52:23 2021
Size of extra inode fields: 32

 

References:

[1] https://www.linuxshelltips.com/find-file-creation-date/

[2] https://www.baeldung.com/linux/get-file-creation-date


 

Wednesday, March 22, 2023

Jetson Nano installation

 

Installing cuda11 in Jetson Nano [1]. All instructins works, but doesn't run on it. Better is cuda10.

 

[1] https://jfrog.com/connect/post/installing-cuda-on-nvidia-jetson-nano/

 

 

Errors:

The following packages have unmet dependencies

...
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

Fix:

sudo apt-get -o dpkg::Options::="--force-overwrite" install --fix-broken

 

Tuesday, March 21, 2023

Python and OpenCV issues

Error:

   import cv2, numpy as np,time
 File "/home/fincahuanaco/.local/lib/python3.7/site-packages/cv2/__init__.py", line 3, in <module>
   from .cv2 import *
ImportError: numpy.core.multiarray failed to import

 

Solution:

$ python3 -m pip install opencv-python==4.0.0.21

$ python3 -m pip list  
 

opencv-python          4.0.0.21

numpy                  1.15.0

 

Other combinations

opencv_python==4.4.0.46 and numpy==1.19.3 works.

 

Saturday, March 18, 2023

AWS Common commands

 

Without ifconfig command

public IP

$ curl ifconfig.me

private IP

$ ip addr 

References:

[1] https://opensource.com/article/18/5/how-find-ip-address-linux

Monday, February 13, 2023

ffmpeg: Extract mp3 from video

 

 ffmpeg -i mad-principio_peter.mp4 -vn -y out1.mp3 #9M

 

ffmpeg -i mad-principio_peter.mp4 -f mp3 -ab 192000 -vn out2.mp3 #14M

ffmpeg -i mad-principio_peter.mp4 -f mp3 -ab 128000 -vn out3.mp3 #9M
ffmpeg -i mad-principio_peter.mp4 -vn -acodec libmp3lame out4.mp3 #9M

ffmpeg -i mad-principio_peter.mp4 -acodec libmp3lame -ab 128k out5.mp3 #9M

ffmpeg -i gym.mp4 -f webm -c:v libvpx -b:v 1M -acodec libvorbis gym.webm -hide_banner

Second

ffmpeg -i sample.avi -q:a 0 -map a sample.mp3  #complete
ffmpeg -i sample.avi -ss 00:03:05 -t 00:00:45.0 -q:a 0 -map a sample.mp3 #fraction
Parameters :
-q:a 0 for variable bit rate
-ss starting timestamp
-t  the encoding time (If you don't specify, it will go to the end)
-map 0:a:3 selects audio stream #4 (ffmpeg starts counting from 0) 
** specific the timestamps in HH:MM:SS.xxx format.

 

References:

[1] https://json2video.com/how-to/ffmpeg-course/ffmpeg-extract-audio.html

Friday, December 23, 2022

Download zip file from Google Drive

 First

Share your file in GD (with anybody access by link) and get FILEID

Second

Execute next code(replace FILEID and choose FILENAME):

wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

 

Note:

Previous methods doesn't work, because now GD needs confirmation, then using cookies it's possible.

Monday, December 12, 2022

Ubuntu NFS Installation

On Server (10.10.7.229):

$ sudo apt install nfs-kernel-server  #install server

$ sudo mkdir -p /mnt/nfs_drive  #create share point

$ sudo chown -R nobody:nogroup /mnt/nfs_drive  #no owner

$ sudo chmod 777 /mnt/nfs_drive  #set r/w permission

$ sudo vi /etc/exports  #define clients grants
 

/mnt/nfs_drive 10.10.7.218(rw,sync,no_subtree_check) #mine
/mnt/nfs_drive 10.10.7.235(rw,sync,no_subtree_check) #houdini

$ sudo exportfs -a

$ sudo systemctl restart nfs-kernel-server
 

On Client: 

$ sudo apt install nfs-common 

$ sudo mkdir -p /mnt/nfs_drive_client   #mirror

$ sudo mount 10.10.7.229:/mnt/nfs_drive /mnt/nfs_drive_client

Notes: 

$ sudo ufw status  #verify the firewall, more details in reference[0]


References: 

[0] Working https://linuxhint.com/install-and-configure-nfs-server-ubuntu-22-04/

[1] https://www.tecmint.com/install-nfs-server-on-ubuntu/

Wednesday, November 23, 2022

qemu bridge to enable network during simulation

 Install brctl

 sudo apt install bridge-utils

Add new virtual bridge

sudo brctl addbr virbr0
sudo brctl addif virbr0 eth0 

Check

/etc/qemu-ifup and /etc/qemu-ifdown  #files
 

 

 

 

Friday, November 18, 2022

Gimp Python-Fu

 

[0] https://www.gimp.org/docs/python/index.html#PREGION-OBJECT-MEMBERS

[1] https://www.gimp.org/docs/python/index.html#DRAWABLE-OBJECT-METHODS

[2] http://myvirtualbrain.blogspot.com/2012/06/gimp-python-fu-very-basics.html 

[3] Samples https://github.com/jfmdev/PythonFuSamples

[4] https://github.com/gummyCowboy/GIMP-python-fu

[5] https://gist.github.com/garystafford/5259576a7e9299d5b80284489aa25fc3


Tuesday, May 03, 2022

Ubuntu upgrade cmake

 

1. Download https://cmake.org/download/

2. Unpack and enter to folder to execute commands

./bootstrap
make -j$(nproc)
sudo make install
 

 References

[1] https://askubuntu.com/questions/355565/how-do-i-install-the-latest-version-of-cmake-from-the-command-line

 

Wednesday, April 27, 2022

Saturday, March 12, 2022

Linux Libraries path

#Cuda 8.0 Settings
export CUDA_HOME=/usr/local/cuda-8.0
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64  
PATH=${CUDA_HOME}/bin:${PATH}


#Cuda 9.1 Settings
export CUDA_HOME=/usr/local/cuda-9.1
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64  
PATH=${CUDA_HOME}/bin:${PATH}


#Cuda 9.2 Settings
export CUDA_HOME=/usr/local/cuda-9.2
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64  
PATH=${CUDA_HOME}/bin:${PATH}

 

$ LD_LIBRARY_PATH=. ./programtest  #direct execution
 

$ echo $LD_LIBRARY_PATH  
/usr/local/cuda-8.0/lib64
 

$ ls /etc/ld.so.conf.d
cuda-8-0.conf                   opencv.conf
fakeroot-x86_64-linux-gnu.conf  x86_64-linux-gnu.conf
glew.conf                       x86_64-linux-gnu_EGL.conf
i386-linux-gnu.conf             x86_64-linux-gnu_GL.conf
libc.conf                       zz_i386-biarch-compat.conf

$ldconfig -p  #list libraries

$sudo ldconfig #update paths

 

 


 

Tuesday, November 16, 2021

Update Chrome in Ubuntu

 


# Install
# via http://askubuntu.com/questions/510056/how-to-install-google-chrome

wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - 
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update 
sudo apt-get install google-chrome-stable


# Update

sudo apt-get --only-upgrade install google-chrome-stable

Tuesday, October 26, 2021

Video tools online

Rotate/Crop/Resize

[1] https://ezgif.com/rotate-video

[2] Fast https://www.rotatevideo.org/ 


Firefox open multiple private window

    /opt/firefox/firefox-bin --profile $(mktemp -d) --private-window www.google.com www.bing.com