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()
Monday, August 26, 2019
CGAL Alpha Shape Demos
Install CGAL
sudo apt-get install libcgal-dev
Compiling
g++ ex_alpha_shapes3.cpp -o ex1 -lCGAL -lgmp -frounding-math
Install Dependences for AlphaShape code
qtscript5-dev
libqt5opengl5-dev
libqt5svg5-dev
Others
[1] Poisson Disk Sample http://devmag.org.za/2009/05/03/poisson-disk-sampling/
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
Saturday, May 18, 2019
Visualization Resources
[1] A library for scientific data visualization
http://mathgl.sourceforge.net/doc_en/Main.html
https://sourceforge.net/projects/mathgl/
[2] t-sne Parameters https://distill.pub/2016/misread-tsne/
Tuesday, May 07, 2019
Fedora VPN
wget https://git.io/vpn -O openvpn-install.sh
References:
[1] https://www.ostechnix.com/easiest-way-install-configure-openvpn-server-linux/
[2] https://kifarunix.com/install-and-setup-openvpn-server-on-fedora-29-centos-7/2/
Reopen connection after close during openvpn execing
Linux:
Connection drop after active openvpn
/etc/sysctl.conf net.ipv4.ip_forward = 1
Windows:
https://www.geeknetic.es/Noticia/10486/Trucos-Como-usar-una-VPN-accediendo-a-Internet-con-tu-conexion-local.html
https://tutorialesenlinea.es/409-conectar-por-vpn-sin-perder-la-conexion-a-internet.html
https://social.technet.microsoft.com/Forums/es-ES/044c7659-3f63-42fd-b15f-f75a4291c080/conectarse-por-vpn-a-un-equipo-remoto-y-perder-la-conexin-a-internet-con-los-demas-programas?forum=servinfoeslatames
http://elblogdejuanbo.blogspot.com/2011/10/conexion-desde-casa-una-vpn-sin-perder.html
Monday, March 25, 2019
Thursday, March 21, 2019
Cuda Installation resources
Cuda 10:
[1] last version https://developer.nvidia.com/cuda-downloads
Cuda 8:
#error -- unsupported GNU version! gcc versions later than 5 are not supported!
#error -- unsupported GNU version! gcc versions later than 5 are not supported!
$ sudo ln -s /usr/bin/gcc-4.9 /usr/local/cuda/bin/gcc
$ sudo ln -s /usr/bin/g++-4.9 /usr/local/cuda/bin/g++
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
[1] https://developer.nvidia.com/cuda-80-ga2-download-archive
Fluid animation tools
Courses:
[1] bridson https://www.cs.ubc.ca/~rbridson/fluidsimulation/
Resources and Source Code:
[1] PBD http://www.interactive-graphics.de/index.php/research/108-a-survey-on-position-based-dynamics-2017
Wednesday, March 20, 2019
mySQL ODBC Driver error 5.2
Error 1918. Error installing ODBC driver MySQL ODBC 5.3 ANSI Driver, ODBC error 13: The setup routines for the MySQL ODBC 5.3 ANSI Driver ODBC driver could not be loaded due to system error code 126: The
Solution:
MySQL Connector/ODBC requires Microsoft Visual C++ 2010 redistributable so you have to install it first.
Resources:
[1] MySQL Connector/ODBC 32-bit version, you have to download and install Microsoft Visual C++ 2010 Redistributable Package (x86).
[2] MySQL Connector/ODBC 64-bit version, you have to download and install Microsoft Visual C++ 2010 Redistributable Package (x64).
Tuesday, March 19, 2019
Saturday, March 16, 2019
Postgres Lectures for improve performance
References:
[1] https://revs.runtime-revolution.com/streaming-data-in-postgres-43c502a6732
https://revs.runtime-revolution.com/streaming-data-in-postgres-43c502a6732
[2] https://blog.timescale.com/scalable-postgresql-high-availability-read-scalability-streaming-replication-fb95023e2af/
[3] https://www.pipelinedb.com/
[4] https://www.citusdata.com/blog/2017/11/08/faster-bulk-loading-in-postgresql-with-copy/
[5] https://dzone.com/articles/postgresql-vs-hadoop
Linux Remote Desktop
sudo apt-get update sudo apt-get install xrdp
#desktop
sudo apt-get install mate-core mate-desktop-environment mate-notification-daemon
#setting session
sudo sed -i.bak '/fi/a #xrdp multiple users configuration \n mate-session \n' /etc/xrdp/startwm.sh
#firewall
sudo ufw allow 3389/tcp
#Use remmina desktop to connect
Extra
service --status-all
printf 'Desktop: %s\nSession: %s\n' "$XDG_CURRENT_DESKTOP" "$GDMSESSION"References:
[1] Setting xrdp https://medium.com/@vivekteega/how-to-setup-an-xrdp-server-on-ubuntu-18-04-89f7e205bd4e
[2] https://websiteforstudents.com/connect-to-ubuntu-16-04-17-10-18-04-desktop-via-remote-desktop-connection-rdp-with-xrdp/
[3] Print desktop name and session
https://askubuntu.com/questions/72549/how-to-determine-which-window-manager-is-running
Friday, March 15, 2019
SSH Skip port forwarding
Instant terminal sharing
https://tmate.io/
Share your UNIX terminal in seconds!
https://www.teleconsole.com/
Share local machine port to public access
https://github.com/milio48/serveo
$wget https://raw.githubusercontent.com/milio48/serveo/master/serveo.sh
$./serveo.sh tcp 5432 0
vs ngrok
Serveo is an excellent alternative to ngrok. Serveo was inspired by ngrok and attempts to serve many of the same purposes. The primary advantage of Serveo over ngrok is the use of your existing SSH client, so there's no client application to install.
Other slight advantages include preservation of URLs across reconnect for free (ngrok allows this only for paid accounts) and in-terminal request inspection and replay (ngrok uses a web interface).
vs OpenSSH
Using Serveo instead of OpenSSH frees you from having to configure and maintain a server. It also handles HTTPS and subdomain generation, two features that complicate a typical SSH port-forwarding setup.
Apache Guacamole is a clientless remote desktop gateway
http://guacamole.apache.org/
Manual mode (A like to connect to B)
PCA ----+---- PCB
|
PCX
Server Side (PCX Need root permission)
$sudo vi /etc/ssh/sshd_config
AllowTcpForwarding yes
GatewayPorts yes
$sudo firewall-cmd --add-port=7004/udp [--permanent]
$sudo firewall-cmd --add-port=7004/tcp [--permanent]
Target PCB
$ssh -f -N -R 7004:127.0.0.1:22 -l user_PCX -p port PCX(ip/domain name)
This means open port 7004 on PCX forwarding to port 22, PCX will start to listen on port 7004.
Source PCA
$ssh PCX(ip/domain name) -l user_PCB -p 7004
Enjoy!
References:
[1] https://rootsaid.com/ssh-without-port-forwarding/
[2] https://linuxhint.com/ssh-port-forwarding-linux/
[3] https://dev.to/samuyi/the-how-to-of-ssh-port-forwarding-1f4e
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/
Sunday, March 10, 2019
mySql Optimize date queries and inserts
High Level of use
DROP INDEX VENTAS_fecven_idx ON VENTAS
select * from VENTAS where date(fecven)='2019-03-09' #~2.81
select * from VENTAS where fecven >='2019-03-09 00:00:00' and fecven<'2019-03-10 00:00:00' #~2.9
select * from VENTAS where fecven Between '2019-03-09 00:00:00' and '2019-03-10 00:00:00' #~3.6
CREATE INDEX VENTAS_fecven_idx ON VENTAS (fecven)
select * from VENTAS where date(fecven)='2019-03-09' #~2.794
select * from VENTAS where fecven >='2019-03-09 00:00:00' and fecven<'2019-03-10 00:00:00' #~0.265
select * from VENTAS where fecven Between '2019-03-09 00:00:00' and '2019-03-10 00:00:00' #~0.261
CREATE INDEX MOVPRO_fecmov_idx ON MOVPRO (fecmov)
#change date(fecmov) between f1 and f2
#to fecmov between f1 and f2 #implicit add 00:00:00
DROP INDEX MOVPRO_fecmov_idx ON MOVPRO
Setting mysql
SET GLOBAL bulk_insert_buffer_size = 1024 * 1024 * 128;
[mysqld]
bulk_insert_buffer_size=128M
References
[1] Insert https://dev.mysql.com/doc/refman/8.0/en/insert-optimization.html
[2] Amazon Best Practices https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_BestPractices.html
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/
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
mySql Optimization parameters or commands
Query
SHOW GLOBAL STATUS
SHOW VARIABLES LIKE '%size%';
SHOW GLOBAL VARIABLES LIKE '%size%';
Settings
SET GLOBAL join_buffer_size = 1024 * 1024 * 128 #128M
or
[mysqld]
join_buffer_size = 128M #default ~256K
References:
[0] Compute memory http://mysqlcalculator.com/
[1]
https://dba.stackexchange.com/questions/74693/how-to-break-table-into-two-without-losing-performance
join_buffer_size
[2] https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html
[3] Example tunning https://dba.stackexchange.com/questions/127862/tuning-mysql-variables-to-accommodate-high-load
[4] Query variables https://dev.mysql.com/doc/refman/8.0/en/show-variables.html
Sunat Servicios Web
-
Resources: [1] Hela https://ome.grc.nia.nih.gov/iicbu2008/hela/index.html
-
Sunedu Renacyt 1) https://ctivitae.concytec.gob.pe/appDirectorioCTI/ 2) http://regina.concytec.gob.pe 3) https://www.gob.pe/9648-ser-p...
-
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 (Wrong GPS tracking) Strava (Curr...