Μηνιαία αρχεία: Μάρτιος 2020


Handbook of COVID-19 Prevention and Treatment

[download id=”5353″]

This is an unprecedented global war, and mankind is facing the same enemy, the novel corona- virus. And the first battlefield is the hospital where our soldiers are the medical workers.
To ensure that this war can be won, we must first make sure that our medical staff is guaranteed sufficient resources, including experience and technologies. Also, we need to make sure that the hospital is the battleground where we eliminate the virus, not where the virus defeats us.
Therefore, Jack Ma Foundation and Alibaba Foundation have convened a group of medical experts who have just returned from the frontlines of fighting the pandemic. With the support of The First Affiliated Hospital, Zhejiang University School of Medicine (FAHZU), they quickly published a guidebook on the clinical experience of how to treat this new coronavirus. The treatment guide offers advice and reference against the pandemic for medical staff around the world who are about to join the war.
Thanks to the medical staff from FAHZU. While taking huge risks in treating COVID-19 patients, they wrote down their treatment experience day and night in this Handbook.
Over the past 50 days, 104 confirmed patients have been admitted to FAHZU, including 78 severe and critically ill ones. Thanks to the pioneering efforts of medical staff and the application of new technologies, to date, we have witnessed a miracle. No staff is infected, and there is no missed diagnosis or patient deaths.
Today, with the spread of the pandemic, these experiences are the most valuable sources of information and the most important weapon for medical workers on the battlefield. This is a brand-new disease, and China was the first to suffer from the pandemic. Isolation, diagnosis, treatment, protective measures, and rehabilitation have all been started from scratch, but we hope that with the advent of this Handbook doctors and nurses in other affected areas can learn from our experience when entering the battlefield and they won’t have to start from zero.
This pandemic is a common challenge faced by mankind in the age of globalization. At this moment, sharing resources, experiences and lessons, regardless of who you are, is our only chance to win. Because the real remedy for epidemics is not isolation, but cooperation.
This war has just begun.

[download id=”5353″]

[download id=”5353″]


How to find differences between two directories using diff

Gotta love diff!

Finding all files and folders that are different in two locations is extremely easy. Using only two parameters we can exhaustively compare two directories, including their sub-directories and produce a list of their differences as such:

diff -qr folder-1/ folder-2/;

The -q parameter instructs diff to print only the files that are different and thus not spam us with thousands of files that are the same.

The -r parameter turns on the recursive feature which instructs diff to check all sub-folders and their files in the two directories under investigation.

Example run:

diff -qr Desktop/source/ /media/tux/My\ Disk/backup\ A/

Files Desktop/source/Camera/20191023_171328.jpg and /media/tux/My\ Disk/backup\ A/Camera/20191023_171328.jpg differ

Files Desktop/source/Camera/VID_20191011_115231.mp4 and /media/tux/My\ Disk/backup\ A/Camera/VID_20191011_115231.mp4 differ

diff: /media/xeirwn//media/tux/My\ Disk/backup\ A/Camera/IMG_20191225_165939.jpg: Input/output error

How to temporarily open MySQL / MariaDB port on CentOS 7 firewall

Recently, we came across a CentOS 7 that was executing MariaDB (MySQL) server. The Database Administrators needed a way to open to the port and allow connections to the SQL server from outside the machine.
As they did not have a specific IP from which they would connect, we provided the following solution.

To temporarily open port 3306

firewall-cmd --add-port=3306/tcp;

To close the port 3306 (method A)

firewall-cmd --remove-port=3306/tcp;

or reload firewalld which will cause it to loose all changes that are not permanent (method B)

firewall-cmd  --reload;

firewalld (Dynamic Firewall Manager) tool provides a dynamically managed firewall. The tool enables network/firewall zones to define the trust level of network connections and/or interfaces. It has support both for IPv4 and IPv6 firewall settings. Also, it supports Ethernet bridges and allow you to separate between runtime and permanent configuration options. Finally, it supports an interface for services or applications to add firewall rules directly.


Safari: ‘a.getTime’ is undefined

Recently, we were working with Google Charts at which we were presenting data from a timeline with some processing.
Our JavaScript code was formatted as follows to create Date objects:

$value = "2020-03-19 23:45:00";
var dateStrFormat = new Date($value);

The above code worked fine on Firefox and Chrome but it failed on Safari with the error:
a.getTime is not a function. (In 'a.getTime()', 'a.getTime' is undefined)
After some investigation we found that Safari does not support a Date() constructor that contains time as well so we had to change the code to the following block:

var dateStr = "2020-03-19";
var dateStrFormat = new Date(dateStr);
var hourStr = "23";
var minutesStr = "45";
dateStrFormat.setHours(hourStr, minutesStr);

The above works on all browsers!