Protect files and folders


Install safe-rm
sudo apt-get install safe-rm

Edit the conf file adding the folders path
pico /etc/safe-rm.conf


PHP CSV to Table


<?php
echo "<html><body><table>\n\n";
$f = fopen("so-csv.csv", "r");
while (($line = fgetcsv($f)) !== false) {
        echo "<tr>";
        foreach ($line as $cell) {
                echo "<td>" . htmlspecialchars($cell) . "</td>";
        }
        echo "</tr>\n";
}
fclose($f);
echo "\n</table></body></html>";
?> 
 
 

AWK get text between two patterns




awk '/BEGIN/,/END/' info.txt 
 
***** BEGIN *****
BASH is awesome
BASH is awesome
***** END *****
 
 

Fix Bug Phpmyadmin [sql.lib.php] + Php7.2 + Ubuntu 18.04

Edit file:

/usr/share/phpmyadmin/libraries/sql.lib.php

Change this (line #613):

|| (count($analyzed_sql_results[‘select_expr’] == 1)

there's a missing close bracket ‘)’ before operation with 1. So i changed it to:

|| ((count($analyzed_sql_results[‘select_expr’]) == 1)

 

Ubuntu 18.04 change hostname


1. Change the hostname using hostnamectl.

In Ubuntu 18.04 we can change the system hostname and related settings using the command hostnamectl.

For example is we want to change the system static hostname to linuxize, we can use the following command:

sudo hostnamectl set-hostname linuxize

2. Edit the /etc/hosts file.Open the /etc/hosts file and change the old hostname to the new one.

127.0.0.1   localhost
127.0.0.1   linuxize

3. Edit the cloud.cfg file.

If the cloud-init package is installed you also need to edit the cloud.cfg file. This package is usually installed by default in the images provided by the cloud providers such as AWS and it is used to handle the initialization of the cloud instances.
To check if the package is installed run the following ls command:

ls -l /etc/cloud/cloud.cfg

In this case you’ll need to open the /etc/cloud/cloud.cfg file:
sudo nano /etc/cloud/cloud.cfg

Search for preserve_hostname and change the value from false to true:

# This will cause the set+update hostname module to not operate (if true)
preserve_hostname: true



Install MSIX with powershell

 Add-AppxPackage -Path "C:\Users\MyUserName\Downloads\affinity-designer-2.0.0.msix" -DependencyPath " https://aka.ms/Microsof...

Mais vistos