Posts

How to upgrade to Postgis 2.4.4

To upgrade postgis, you need download the tarball and compile it:

wget https://download.osgeo.org/postgis/source/postgis-2.4.4.tar.gz
tar xvzf postgis-2.4.4.tar.gz
cd postgis-2.4.4
./configure

configure: WARNING:  --------- GEOS VERSION WARNING ------------ 
configure: WARNING:   You are building against GEOS 3.5.1 
configure: WARNING:   To take advantage of all the features of 
configure: WARNING:   this PostGIS version requires GEOS 3.7.0 or higher which is not out yet.
configure: WARNING:   To take advantage of most of the features of this PostGIS
configure: WARNING:   we recommend GEOS 3.6 or higher
configure: WARNING:   You can download the latest versions from 
configure: WARNING:   http://trac.osgeo.org/geos 

We need to install the lastest geos version

cd ..
wget http://download.osgeo.org/geos/geos-3.7.0rc1.tar.bz2
tar xjvf geos-3.7.0rc1.tar.bz2
cd geos-3.7.0rc1
./configure
make -j4; sudo make install

Now, come back to postgis to finish the configuration:

cd ../postgis-2.4.4
postgis
./configure
make

AttributeError: module 'lib' has no attribute 'SSL_ST_INIT'

I wanted to upgrade pip but I couldn't by the following error:
sudo pip install --upgrade pip  Traceback (most recent call last):   File "/usr/local/bin/pip", line 7, in <module>     from pip._internal import main   File "/usr/local/lib/python3.5/dist-packages/pip/_internal/__init__.py", line 42, in <module>     from pip._internal import cmdoptions   File "/usr/local/lib/python3.5/dist-packages/pip/_internal/cmdoptions.py", line 16, in <module>     from pip._internal.index import (   File "/usr/local/lib/python3.5/dist-packages/pip/_internal/index.py", line 14, in <module>     from pip._vendor import html5lib, requests, six   File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/requests/__init__.py", line 97, in <module>     from pip._vendor.urllib3.contrib import pyopenssl   File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>     import Op…

How to insert code in an interactive python console througth Visual Studio Code

Image
After run your code, to edit or add new instructions is not neccesary run all your code again.
A good idea is to run a partial or section code. To do it, you must run your code as interactive mode.

You have 3 ways to do it with vscode:

1.- Task
You can create a task to run python in interactive mode.
Press Ctrl+Shift+P and type: Configure Task
Paste the following code:

{ "version": "2.0.0", "tasks": [ { "label": "Run File", "command": "python3 -i ${file}", "type": "shell", "group": { "kind": "build", "isDefault": true }, "presentation": { "reveal": "always", "focus": true } }
This task is named "Run File" and execute python3 in interactive mode. Focus options allows focus keyboard on the terminal.
To run the task press Ctrl+Shift+B

2.- Code Runner extension.
To install it, press …

How to decrypt SSL/TLS connections with wireshark

Image
If you try to understand your SSL/TLS connections generated by your web browser like chrome, firefox or others, you must create a new variable in your .bashrc file as follows:

export SSLKEYLOGFILE="$HOME/sslkeylog.log"

To tells Wireshark where is this file, yo need specified the path in:

Edit / Preferences / Protocols / SSL / (Pre)-Master-Secret log filename.


Now, when you will call your browser from the terminal, it will generate sslkeylog.log with all private keys for each site, and wireshark would decrypt SSL/TLS traffic. Here is an example:

Enjoy!

How to fix VirtualBox error when you try to import an ova file

If you download an ova file to import it to Virtualbox, maybe you will see the following message:

Failed to import appliance filename.ova.

Seeking within the archive failed (VERR_TAR_UNEXPECTED_EOS).

Result Code: VBOX_E_IPRT_ERROR (0x80BB0005)
Component: ApplianceWrap
Interface: IAppliance {8398f026-4add-4474-5bc3-2f9f2140b23e}

If you do it the same throught VBoxManage you will get:

# VBoxManage import filename.ova 
Progress state: VBOX_E_IPRT_ERROR
VBoxManage: error: Appliance import failed
VBoxManage: error: Seeking within the archive failed (VERR_TAR_UNEXPECTED_EOS)
VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component ApplianceWrap, interface IAppliance
VBoxManage: error: Context: "RTEXITCODE handleImportAppliance(HandlerArg*)" at line 877 of file VBoxManageAppliance.cpp


To fix it, you must extract ova content and compress again as follows:

tar xvf filename.ova
tar cvf newfilename.ova filename.ovf filename.vmdk

Also, you can import the virtual machine with double…

How to convert from LaTeX to HTML file

If you have a .tex file and you want to convert it to a .html file you can use LaTeXML.

# git clone https://github.com/brucemiller/LaTeXML.git
# sudo apt-get install libimage-size-perl libimage-magick-perl
# cd LaTeXML
# perl Makefile.PL

Warning: prerequisite Parse::RecDescent 0 not found.
Warning: prerequisite Text::Unidecode 0 not found.
Warning: prerequisite Image::Size 0 not found.
Warning: prerequisite XML::LibXSLT 1.58 not found.

To install these perl dependencies, you must use the following commands:

# sudo cpan z Parse::RecDescent
# sudo cpan z Text::Unidecode
# sudo cpan z Image::Size
# sudo cpan z XML::LibXSLT

looking for -lxslt... no
libxslt not found
Try setting LIBS and INC values on the command line
Or get libxslt and libxml2 from
  http://www.libxml.org/
If you install via RPMs, make sure you also install the -devel
RPMs, as this is where the headers (.h files) are.
No 'Makefile' created  SHLOMIF/XML-LibXSLT-1.96.tar.gz
  /usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK

If you h…

How to fix Low disk space on "boot"

A common issue is when /boot partition is full. You receive the following message:

"Low disk space on "boot". The volume "boot" has only 0 bytes disk space remaining"

To fix it, you must delete old kernels.
First, you must list all of them and I recomend remove the oldest and keep the last two newest (if you have problems with the last, you can use the other).

To list all of them, use this command:

# dpkg -l linux-image-\* | grep ^ii | awk '{print $2}'
linux-image-4.13.0-36-generic
linux-image-4.13.0-37-generic
linux-image-4.13.0-38-generic
linux-image-4.13.0-39-generic
linux-image-4.13.0-41-generic

Now, you must purge the oldest kernels with the following command:

# sudo apt-get purge linux-image-4.13.0-{36,37,38}-generic

You need to change the values according to the values you have.
Finally, update grub

# sudo update-grub

Enjoy it!