Friday, September 20, 2019
Point Splatting codes
Compile GLviz
[1] code https://github.com/sebastianlipponer/glviz
error: storage size of ‘shell_surface_listener’ isn’t known
static const struct wl_shell_surface_listener shell_surface_listener = {
solution: add #include "wayland-client-protocol.h" in SDL_waylandwindow.c
Not able to make successfully - undefined reference to symbol 'XCreateBitmapFromData'
add into extern/anttweakbar/CMakeLists.txt after set_target_properties(anttweakbar ... )
if (UNIX)
target_link_libraries(anttweakbar X11)
endif()
Based on GLViz
[2] Surface Splatting code https://github.com/sebastianlipponer/surface_splatting
error: storage size of ‘shell_surface_listener’ isn’t known
static const struct wl_shell_surface_listener shell_surface_listener = {
solution: add #include "wayland-client-protocol.h" in SDL_waylandwindow.c
Not able to make successfully - undefined reference to symbol 'XCreateBitmapFromData'
add into extern/anttweakbar/CMakeLists.txt after set_target_properties(anttweakbar ... )
if (UNIX)
target_link_libraries(anttweakbar X11)
endif()
Friday, August 09, 2019
DualSPHysics Compile
Resources:
[1] code https://github.com/DualSPHysics/DualSPHysics
[2] scripts to execute models https://github.com/fincahuanaco/DualSPHysicsScripts
[3] https://dual.sphysics.org/index.php/downloads/
[4] https://dual.sphysics.org/files/3313/8753/4540/DualSPHysics_v3.0_GUIDE.pdf
[5] https://github.com/DualSPHysics/DualSPHysics/wiki/12.-Testcases#obc7
Update 2021
compile GPU version (CMakeLists.txt will find cuda, display ${CUDA_VERSION} to verify if is getting the right version).
See https://melhorum.blogspot.com/2021/03/cuda-8-on-linux18.html to install CUDA and requeriments.
on DualSPHysics/src/source
mkdir build
cd build
export CC=/usr/bin/gcc-5;CXX=/usr/bin/g++-5 #for cuda 8
export CC=/usr/bin/gcc-6;CXX=/usr/bin/g++-6 #for cuda 9
cmake ..
make In some cases you need to reduce cuda version to execute simulation. in case of GeForce GTX 460(with Driver Version: 390.59). I was forced to change from cuda9(supported) to cuda8(supported too) to execute simulations with around 360k particles.
Make Model
[1] https://www.freecadweb.org/
Saturday, August 03, 2019
Latex tools
Resources:
[1] Mathpix https://snapcraft.io/mathpix-snipping-tool
https://snapcraft.io/install/mathpix-snipping-tool/ubuntu
[2]
Monday, July 01, 2019
Video file to gif animation
ffmpeg can create gif from mp4/mpeg file, but create low quality, for resolve this we need to create a palette for increase quality.
Create palette colors
$ffmpeg -i file.mpeg -vf fps=15,scale=-1:-1:flags=lanczos,palettegen palette.png
Use palette for create gif from complete mp4 file
$ffmpeg -i file.mp4 -i palette.png -filter_complex "fps=15,scale=-1:-1:flags=lanczos[x];[x][1:v]paletteuse" out_full.gif
Use palette for create gif from mp4 file (from 0:55 and 9seconds)
$ffmpeg -ss 0:55 -t 9 -i file.mp4 -i palette.png -filter_complex "fps=15,scale=-1:-1:flags=lanczos[x];[x][1:v]paletteuse" out_fraction.gif
Without palette
$ffmpeg -i imagebind.mp4 -r 10 -f image2pipe -vcodec ppm - | convert -delay 5 -loop 0 - imagebind.gif
Convert png files list to mp4 (two ways)
$avconv -r 20 -i buffer/plot%d.png -b:v 4000k animation_h1.mp4
$ffmpeg -i buffer/plot%d.png -r 20 -b 4M animation_h2.mp4
Convert jpg files into mp4
$ffmpeg -framerate 1 -i frames/f%d.jpg -r 2 -pix_fmt yuv420p video.mp4
$ffmpeg -framerate 10 -i Dragon.%04d.png -r 2 -pix_fmt yuv420p video.mp4
Cut/Extract video fraction same quality no filter/codec
$ffmpeg -ss 3:19 -t 4 -i Moana_WaterFX.mp4 -vcodec copy -acodec copy Moana_f3.mp4
Convert mp4 to gif using palette and resizing
$ffmpeg -i psplat2_4k.mp4 -i palette_psplat2_4k.png -filter_complex "fps=15,scale=-1:-1:flags=lanczos[x];[x][1:v]paletteuse" -s 346x264 psplat2_4k.gif
$ffmpeg -i fluidhoudini.mp4 -i palette.png -filter_complex "fps=15,scale=-1:-1:flags=lanczos[x];[x][1:v]paletteuse" -s 640x480 fluidhoudini_palette_640.gif
Crop image video
To crop a 528×336 section, starting from position (264, 30):
ffmpeg -i first_256.mp4 -filter:v "crop=528:336:264:30" -c:a copy first_256_crop.mp4
#ffmpeg -i in.mp4 -filter:v "crop=out_w:out_h:x:y" out.mp4
Error on Image Magick (convert)
convert-im6.q16: cache resources exhausted
open file /etc/ImageMagick-6/policy.xml
and change
<policy domain="resource" name="disk" value="1GiB"/>
To
<policy domain="resource" name="disk" value="8GB"/>
Or
<!-- disable ghostscript format types -->
<policy domain="coder" rights="none" pattern="PS" />
<policy domain="coder" rights="none" pattern="EPS" />
<policy domain="coder" rights="none" pattern="PDF" /> <------- Here!!
<policy domain="coder" rights="none" pattern="XPS" />
To
<policy domain="coder" rights="read | write" pattern="PDF" />
#Change by code
sed -i -E 's/name="memory" value=".+"/name="memory" value="1GiB"/g' /etc/ImageMagick-6/policy.xml
sed -i -E 's/name="map" value=".+"/name="map" value="1GiB"/g' /etc/ImageMagick-6/policy.xml
sed -i -E 's/name="area" value=".+"/name="area" value="1GiB"/g' /etc/ImageMagick-6/policy.xml
sed -i -E 's/name="disk" value=".+"/name="disk" value="4GiB"/g' /etc/ImageMagick-6/policy.xml
For the default 16:9 aspect ratio, encode at these resolutions:
- 2160p: 3840x2160
- 1440p: 2560x1440
- 1080p: 1920x1080
- 720p: 1280x720
- 480p: 854x480
- 360p: 640x360
- 240p: 426x240
Online tools[1] Crop gifs https://ezgif.com
Monday, April 01, 2019
Ubuntu 16 - VMWare Player 12 - GCC Not found
First solution
cd /usr/lib/vmware/modules/source
wget https://github.com/mkubecek/vmware-host-modules/archive/player-12.5.9.zip
unzip player-12.5.9.zip
cd vmware-host-modules-player-12.5.9/vmmon-only/
make
cd ../vmnet-only/
make
cd ..
mkdir /lib/modules/`uname -r`/misc
cp vmmon.o /lib/modules/`uname -r`/misc/vmmon.ko
cp vmnet.o /lib/modules/`uname -r`/misc/vmnet.ko
depmod -a /etc/init.d/vmware restart
Second solution
mkdir ~/vmmodules #create a temp folder and copy files.
cp /usr/lib/vmware/modules/source/vmnet.tar /usr/lib/vmware/modules/source/vmmon.tar ~/vmmodules/
# make the modules manually
tar -xvf vmmon.tar
cd vmmon-only
make
cd ..
sudo cp vmmon.o /lib/modules/`uname -r`/kernel/drivers/misc/vmmon.ko.gz
tar -xvf vmnet.tar
cd vmnet-only
make
cd ..
sudo cp vmnet.o /lib/modules/`uname -r`/kernel/drivers/misc/vmnet.ko.gz
#Then reload the modules and restart vmware service, vmplayer should works now.
sudo depmod -a
sudo systemctl restart vmware
Thrid solution
#install the right version of gcc
$sudo apt-get install g++-4.9
Trick
$sudo sed 's/gcc version 5.4.0/gcc version 6.4.0/' /proc/version > /tmp/version
$sudo mount --bind /tmp/version /proc/version
$sudo vmware-modconfig --console --install-all
$sudo umount /proc/version && rm /tmp/version
Final solution 2019
Update kernel from 4.4 to 4.11 works good[2] and download from [3].
References:
[1] https://unix.stackexchange.com/questions/310637/vmware-kernel-module-a-compatible-version-of-gcc-was-not-found
[2] Update kernel https://www.howtoforge.com/tutorial/how-to-upgrade-linux-kernel-in-ubuntu-1604-server/
[3] Ubuntu kernels https://kernel.ubuntu.com/~kernel-ppa/mainline/
[4] Update Ubuntu 18 kernel https://www.tecmint.com/upgrade-kernel-in-ubuntu/
Saturday, March 16, 2019
Stream Music from your Linux PC to Android Cellphone Speaker
1) SoundWire
2) WiFiAudio Server for Linux 64bit
References:
[1] Client https://appuals.com/stream-audio-pc-android-device/
[2] Server http://georgielabs.net/
[3] http://wifiaudio.boards.net/thread/2/wifiaudio-support-links-download-application
[4] WifiAudio Sever Linux 64bits http://wifiaudio.boards.net/attachment/download/6
Monday, March 11, 2019
Ubuntu route (s)
ip route list
route
route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.169.5.1
sudo route del -net 192.168.76.0/24
and
sudo route del -net 192.168.76.0 netmask 255.255.255.0
References:
[1] https://www.cyberciti.biz/faq/linux-route-add/
Saturday, March 09, 2019
Linux Discovery ports
sudo lsof -iTCP -sTCP:LISTEN
Linux
List used ports
$netstat -tulpn | grep LISTEN
tcp 0 0 127.0.0.1:5939 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp6 0 0 :::80 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 ::1:631 :::* LISTEN -
List process that using port
You like to knows who is using port 80, then
$sudo lsof -i :80
apache2 965 root 4u IPv6 26650 0t0 TCP *:http (LISTEN)
apache2 13794 www-data 4u IPv6 26650 0t0 TCP *:http (LISTEN)
apache2 13795 www-data 4u IPv6 26650 0t0 TCP *:http (LISTEN)
apache2 13796 www-data 4u IPv6 26650 0t0 TCP *:http (LISTEN)
apache2 13797 www-data 4u IPv6 26650 0t0 TCP *:http (LISTEN)
apache2 13798 www-data 4u IPv6 26650 0t0 TCP *:http (LISTEN)
Second option
$sudo netstat -peanut | grep ":80"
tcp6 0 0 :::80 :::* LISTEN 0 26650 965/apache2
Setting apache
$vi /etc/apache2/apache2.conf
# /etc/apache2/
# |-- apache2.conf
# | `-- ports.conf
# |-- mods-enabled
# | |-- *.load
# | `-- *.conf
# |-- conf-enabled
# | `-- *.conf
# `-- sites-enabled
# `-- *.conf
Thursday, March 07, 2019
PostgreSQL 8.4 en CentOS
#vi /etc/yum.repos.d/CentOS-Base.repo
agregar la siguiente linea a [base] y [updates]
exclude=postgresql*
2) AƱadir los repositorios de PostgreSQL 8.4
Descargar el rpm apropiado desde http://yum.pgsqlrpms.org/reporpms/repoview/pgdg-centos.html
#wget http://yum.pgsqlrpms.org/reporpms/8.4/pgdg-centos-8.4-2.noarch.rpm
#rpm -ivh pgdg-centos-8.4-2.noarch.rpm (este archivos es el que descargamos)
3) Instalar PostgreSQL
3.1 verifique version
#yum list postgresql*
#yum install postgresql postgresql-server
3.1 Error probable de dependencia a apr-util
#yum install apr-util
#yum install postgresql postgresql-server
4) Arrancar el servidor y habilitar conexiones remotas
#service postgresql initdb
#service postgresql start
5) Configurar Accesos en /var/lib/pgsql/data/
5.1 pg_hba.conf
host all all 0.0.0.0/0 trust #no need password , use md5
5.2 postgresql.conf
listen_addresses='*'
port=5432
max_connections=100
superuser_reserved_connections=5
6) Reinicia servicio
#/etc/init.d/postgresql restart
Referencias
[0] Postgres 9.1 http://wiki.postgresql.org/wiki/YUM_Installation
[1] Auto Start/Stop http://www.michaelhinds.com/tech/linux/install-postgres.html
[2] http://www.ixavi.com/2010/01/instalar-postgresql-8-3-en-centos-desde-yum/
Linux root password reset
Mode 1:Recover mode
In recover mode try to remount and after that change password
mount -o remount,rw /
Mode 2: Using live
mkdir /mnt/recover
mount /dev/sda2 /mnt/recover
chroot /mnt/recover
passwd #or
passwd user
exit
umount /mnt/recover
Other way : Using files(for root or any user)
/etc/passwd
/etc/shadow
root:x:0:0:root:/root:/bin/bash
to
root::0:0:root:/root:/bin/bash
References:
[1] http://www.microhowto.info/howto/reset_a_forgotten_root_password_using_a_live_distribution.html
[2] https://www.computersecuritystudent.com/UNIX/UBUNTU/1204/lesson5/index.html
Sunday, March 03, 2019
Ubuntu users
#adduser username
#usermod -aG sudo username
$
su - username
$whoami
$sudo whoami
Examples to use
$fdisk -l
$sudo fdisk -l
$sudo ls -l /root
Saturday, March 02, 2019
Sunat Servicios Web
Friday, March 01, 2019
Linux Discover Teamviewer id
$sudo grep -n id /home/user/.local/share/teamviewer14/logfiles/TeamViewer14_Logfile.log
$whereis teamviewer
$/usr/bin/teamviewer help
$/usr/bin/teamviewer info #for get id too
$/usr/bin/teamviewer daemon stop
$/usr/bin/teamviewer setup
$/usr/bin/teamviewer daemon status
$/usr/bin/teamviewer daemon start
References:
[1] http://www.tonisoto.com/2013/07/launching-teamviewer-remotely-throught-ssh/
Monday, February 25, 2019
Ubuntu Apache Django settings
References:
[1] main https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-ubuntu-16-04
[2] https://coderwall.com/p/ooerda/python-django-apache-ubuntu
[3] https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-debian-8
Fixing geopandas and osmnx problem: Could not find libspatialindex_c library file
Traceback (most recent call last):
File "
NameError: name 'find_library' is not defined
The solution is:
import ctypes
from ctypes.util import find_library
When you install environment and install geopandas, rtree and osmnx
pip install git+git://github.com/geopandas/geopandas.git
pip install rtree
pip install osmnx
No error, everythong aparently is ok, and you try to test$python
>>> import rtree
Traceback (most recent call last):
File "
File "/var/www/sampleapp/crivist/myEnv/lib/python3.5/site-packages/rtree/__init__.py", line 1, in
from .index import Rtree
File "/var/www/sampleapp/crivist/myEnv/lib/python3.5/site-packages/rtree/index.py", line 5, in
from . import core
File "/var/www/sampleapp/crivist/myEnv/lib/python3.5/site-packages/rtree/core.py", line 125, in
raise OSError("Could not find libspatialindex_c library file")
OSError: Could not find libspatialindex_c library file
You can solve using:
sudo apt install python3-rtree
But in some servers, you can't access to apt, then you decide do next commands:
$git clone https://github.com/libspatialindex/libspatialindex.git
$cd libspatialindex
$cmake --prefix=/usr .
$make
$sudo make install #You cannot install on system
CMake Error at src/cmake_install.cmake:52 (file):
file INSTALL cannot copy file
"/home/fincahuanaco/Temp/libspatialindex/bin/libspatialindex.so.5.0.0" to
"/usr/local/lib/libspatialindex.so.5.0.0".
Call Stack (most recent call first):
cmake_install.cmake:42 (include)
But you compile, then you have the link to file, then set next variable
export SPATIALINDEX_C_LIBRARY=environmentpath/lib/libspatialindex_c.so
Enjoy
References:
[1] geopandas http://geopandas.org/install.html
[2] python environment https://docs.python-guide.org/dev/virtualenvs/
[3] python environment 2 https://docs.python.org/3/tutorial/venv.html
Thursday, February 21, 2019
Latex On Line
Latex online
[1] Single/public https://www.papeeria.com
[2] Latex/R/Python/Octave/Julia/Shell/GPU https://cocalc.com/
[3] Single
Latex & Octave http://www.verbosus.com/ #limit 4 resources
[4] Quick snap code to image quicklatex.com
Over google docs
http://docs.latexlab.org/
Single Compiler
[1] http://latex.informatik.uni-halle.de/latex-online/latex.php
[2] http://sciencesoft.at/latex/flatex.gsp?lang=en
After register
Unlimited https://www.sharelatex.com/
Monkey http://monkeytex.bradcater.webfactional.com/
Others References
[1] http://tex.stackexchange.com/questions/3/compiling-documents-online
[2] http://texblog.net/latex-link-archive/online-compiler/
Wednesday, February 20, 2019
Fedora 23 - Executing MONO Asp.NET MVC App
Table 'mysql.user' doesn't exist:ERROR
Or
ERROR 1146 (42S02): Table 'mysql.role_edges' doesn't exist
$mysql_upgrade -u root
Access problem (resolve inner mysql)
$mysql -u root -p
>show GRANTS FOR onepoint@localhost;
Execution problem
Turns out simply creating the folder using mkdir
$sudo mkdir /etc/mono/registry
$sudo chmod uog+rw /etc/mono/registry # setting the right permissions
Another way
You can set MONO_REGISTRY_PATH to point to a directory that you control:
$mkdir my-registry
$MONO_REGISTRY_PATH=`pwd`/my-registry
$xsp4
System.MissingMethodException Method 'RouteCollection.get_AppendTrailingSlash' not found.
[uxxx@sxxx MaxxCoreWeb]$ mono --version
Mono JIT compiler version 4.0.5 (Stable 4.0.5.1/1d8d582 Mon Jan 4 11:09:45 UTC 2016)
These message showed because the system was build in mono 4.5 and mono 4.2 (both are compatible
for me in my system), but in my case i installed mono 4, lastest on Fedora 23.
Command for update repository to Fedora 27, but after update still doesn't ran
$rpm --import "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
$su -c 'curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo'
$dnf update
I removed mono and tried to install mono 5, mono 4.8 and mono 4.2, but i got error of conflicts. Then i executed next command:
$sudo dnf autoremove #for remove dependences
And tried again and was successful.
$ sudo dnf install mono-complete-4.8.1.0-0.xamarin.1.x86_64
References:
[1] Upgrade tips https://fedoraproject.org/wiki/DNF_system_upgrade
[2] mono https://www.mono-project.com/download/stable/#download-lin-fedora
Fedora 23 Services
$systemctl status sshd.service
$systemctl enable httpd.service
$systemctl disable service_name.service
$systemctl start service_name.service
$systemctl stop service_name.service
$systemctl restart service_name.service
$systemctl list-units --type=service
References:
[1] General info https://docs.fedoraproject.org/en-US/fedora/rawhide/system-administrators-guide/infrastructure-services/Services_and_Daemons/
[2] List services https://docs.fedoraproject.org/en-US/Fedora/15/html/Deployment_Guide/s1-services-running.html
Tuesday, February 19, 2019
Fedora 29 mySQL
$sudo dnf --disablerepo=mysql80-community --enablerepo=mysql57-community install mysql-community-server
works too for Fedora 23 (Server Edition)
Problems
$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
$ sudo grep 'temporary password' /var/log/mysqld.log
Referencias:
[1] https://www.if-not-true-then-false.com/2010/install-mysql-on-fedora-centos-red-hat-rhel/
-
Sunedu Renacyt 1) https://ctivitae.concytec.gob.pe/appDirectorioCTI/ 2) http://regina.concytec.gob.pe 3) https://www.gob.pe/9648-ser-p...
-
Resources: [1] Hela https://ome.grc.nia.nih.gov/iicbu2008/hela/index.html
-
en inglĆ©s se llama “A potentially dangerous Request.Form value was detected from the client”. varias pĆ”ginas indican dos cosas: 1. agrega...
Running apps
Runtastic (I uninstalled because force to update your device - Internet connection problems) Runkeeper (Currently testing) Runna (Complex,...