Posts

Ubuntu VM change resolution

From within the Ubuntu virtual machine, open Terminalsudo vim /etc/default/grubFind GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"Append that to the end of the line "video=hyperv_fb:[specify resolution, e.g. 1024x768]"For example: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1024x768"Save changes and exitRun the following command: sudo update-grubRestart the VM

Wget single file from github

Image
When you view a file it has a link to the "raw" version.


Click copy URL, in terminal wget (paste):


Mapserver install on Ubuntu 18.04 with Naviserver:

Mapserver install on Ubuntu 18.04 with Naviserver:

I assume you have already installed Naviserver, PostgreSQL and PostGIS.

Update apt-get
apt-get update Install dependencies:
apt-get install libprotobuf-c-dev apt-get install protobuf-c-compiler apt-get install libjpeg-dev apt-get install libfreetype6 apt-get install libfreetype6-dev apt-get install libproj-dev apt-get install libfribidi-dev apt-get install libharfbuzz-dev apt-get install libcairo2-dev apt-get install libgeos-dev apt-get install libgdal-dev apt-get install libpixman-1-dev apt-get install libfcgi-dev

Download Mapserver from http://download.osgeo.org/mapserver/mapserver-7.4.1.tar.gz
Extract tar to some directory, create build directory and run from build

cmake -DCMAKE_INSTALL_PREFIX=/opt/mapserver --DWITH_WITH_KML=ON -DWITH_CLIENT_WFS=ON -DWITH_CLIENT_WMS=ON -DWITH_SOS=ON --DWITH_WITH_XMLMAPFILE=ON ../ It will build and install Mapserver into /opt/mapserver

Ubuntu 17 and 18.04 permanent ressolv.conf

As always Ubuntu managed to f**k up the system.
So every time you reboot system it rewrites /etc/resolve.conf with dummy config

Solution:

sudo apt-get purge resolvconf sudo unlink /etc/resolv.conf sudo touch /etc/resolv.confvim /etc/resolv.confreboot

Oracle, how to pass a '&' in url and other special characters

Function to normalize url link, substitute special characters in link:

CREATE OR REPLACE FUNCTION urlencode( p_str in varchar2 ) return varchar2 AS     l_tmp varchar2(12000);     l_len number default length(p_str);     l_bad varchar2(100) default ' >%}\~];?@&<#{|^[`/:=$+''"' || chr(10);     l_char char(1); BEGIN     IF ( p_str is NULL ) then         RETURN NULL;     END IF;     FOR i IN 1 .. l_len LOOP         l_char := substr(p_str,i,1);         IF ( instr( l_bad, l_char ) > 0 )         THEN             l_tmp := l_tmp || '%' || to_char(ascii(l_char), 'fm0X');         ELSE             l_tmp := l_tmp || l_char;         END IF;     END LOOP; RETURN l_tmp; END; Example:

SET SERVEROUTPUT ONDECLARElink varchar2(2000) :=  'https://mail.google.com/mail/u/1/#inbox/FMfcgxwBVMgHsGkcMPpbLJFxMgkDmNNz&^';linkencoded varchar2(2000);BEGINlinkencoded := urlencode(link);DBMS_OUTPUT.PUT_LINE (linkencoded);END;
Check if UTL_HTTP exists:
I have seen on the internet someone complain about not existing "UTL_HTTP"
SELECT * FROM dba_objects WHERE object_name='UTL_HTTP'
Login do sqlplus:

sys as sysdbaGrant execute to user, in my case im using system user (I know bad idea):
GRANT EXECUTE ON SYS.UTL_HTTP TO system;
Create ACL, you need this if yo are using 11g or up:
pay attention to principal it has to be UPPERCASE, if not it will give you "ORA-44416 Unresolved Principal" error
BEGIN DBMS_NETWORK_ACL_ADMIN.create_acl( acl => 'http_connect.xml', description => 'ACL that lets me talk to the my web server', principal => 'SYSTEM', is_grant => TRUE, privilege => 'connect' ); DBMS_NETWORK_ACL_ADMIN.assign_acl( acl => 'http_connect.xml', HOST => 'maks.tk', lower_port => 80, upper_port =…

Certbot

List all certificates:

sudo certbot certificates Create wildcard certificate for domain example.com:

 sudo certbot certonly --manual --preferred-challenges dns --server https://acme-v02.api.letsencrypt.org/directory --manual-public-ip-logging-ok -d '*.example.com' -d <example.com> Delete certificate:
 sudo certbot delete