Comments in PHP

In PHP, comments can be of three types.

I will give an example of the first (one-line in the style of C ++):

<?php
echo "TEXT"; // Comment
?>

The second one in Unix style:

<?php
echo "TEXT"; # Comment
?>

The third multiline:

<?php
     /* Comment
        Comment
        Comment */
     echo "TEXT";
?>

PHP. Redirect to another page

I’ll give an example of redirecting to another page:

<?php
  header("Location: http://www.example.com/");
  exit;
?>

Example of redirecting in specified number of seconds:

<?php
  header('Refresh: 5; URL=http://www.example.com/');
  echo 'After 5 seconds you will be automatically redirected to another page.';
  exit;
?>

Example of Redirect in JavaScript (this may not work for everyone):

<script type="text/javascript">
  location.replace("http://www.example.com/");
</script>

Example Redirect in JavaScript after 5 seconds (this may not work for everyone):

<script type="text/javascript">
  setTimeout('location.replace("http://www.example.com/")', 5000);
</script>

An example of Redirect in HTML after 5 seconds (if you specify 0, it will redirect immediately):

<meta http-equiv="refresh" content="5; url=http://www.example.com/">

How to remove a Steam account

To delete the Steam account, you need to write a message to the technical support, for this go to the official website
https://support.steampowered.com/kb_article.php?ref=1558-QYAX-1965&l=english

Сlick “I need help“, choose the category of the question “My account” and write a message that we want to delete the account.

A week later I received an answer in which I asked if I really want to delete my account.
To which I replied “Yes, I want to delete my account“, after that, about a week later, the second message came:

The Steam account was disabled at your request. All information posted by him in the Community has been deleted. You will no longer be able to sign in to this account or restore access to it.

Done.

Linux disk test for errors and broken sectors

Switch directly to the root user:

sudo -i

Let’s see the list of disks:

fdisk -l
df -h

You can see the information and model of the disk as follows:

hdparm -i /dev/sda

If SMART is supported, install the utilities and see the SMART statistics:

apt-get install smartmontools
smartctl -a /dev/sda
smartctl -a /dev/sda|grep -i reallocated

Run SMART tests and view information (smartctl -X to stop the long test):

smartctl -H /dev/sda
smartctl --test=long /dev/sda
smartctl -l selftest /dev/sda

Now we will perform a disk check on the broken sectors (-s will display information about scanning, -v more detailed mode):

badblocks -sv /dev/sda1

You can save the result to a file:

badblocks -sv /dev/sda1 > ~/badblocks.list

You may need to unmount the disk to check:

umount /dev/sda1

You can run the test using e2fsck like this:

e2fsck /dev/sda1

See also:
Description of SMART attributes
Diagnostics HDD using smartmontools

How to view saved passwords in Mozilla Thunderbird

In Mozilla Thunderbird it’s pretty simple – saved passwords from email accounts are stored in the settings.

To open them, open the “Settings” by clicking on the icon on the right in the top corner in the form of three horizontal lines, then select “Settings” and in the submenu again “Settings.”

In the window that appears, select “Protection” and go to the “Passwords” tab.

Next, click on the “Saved passwords“.

In the next window that appears, there will be a list of accounts for which passwords were saved, at the bottom click “Display passwords” and another column with passwords will appear in the list.

Done.

Reason for messages “Failure: System is busy, please retry after a while” on Huawei OLT

Once when executing commands in the Huawei SmartAX console, the MA5683T began to notice often the message:

Failure: System is busy, please retry after a while

As it turned out, the reason in my case was Zabbix, which every hour received SNMP levels ONT and drew graphics. SNMP requests from him were packed with packets of 30-50, separately for each port. I solved the problem by increasing the timeout in the Zabbix server configuration and the verification period for more hours, because OLT was slowly issuing information, Zabbix was not available, considered it inaccessible, paused briefly and sent requests again.
Also, in the settings of the Zabbix node, you need to uncheck “Use bulk requests”.

Installing and using iotop

iotop – a console program that displays statistics on the use of disk space.

You can install Debian, Ubuntu, Mint with the command:

sudo apt-get install iotop

In Red Hat, Fedora, CentOS:

yum install iotop

Normal startup:

iotop

Running with the option:

iotop OPTION

I’ll describe the possible startup options:
–version (view version)
-h (view help)
-o (display only active processes or threads that read or write, instead of displaying all)
-b (inclusion of non-interactive mode, convenient for example to output information to a file)
-t (display time in each line, for non-interactive mode -b)
-n NUMBER (the number of iterations after which the output will be executed, if not specified, then the output is not standardized)
-d NUMBER (the delay between iterations in seconds, you can specify not an integer, a standard value of 1)
-p PID (display statistics only for the specified processes / threads, standard for all)
-u USER (display statistics only for specified users, standard for all)
-P (display only processes)
-a (accumulation of statistics from the start of the launch of iotop)
-k (statistics in kilobytes)
-q (shortened view, some header lines are removed, when used with the -b option. There are more abbreviated, for example -qq without title names and -qqq without a general summary)