I will list and describe the standard paths to the cPanel & WHM configuration files:
Continue reading “Location of configuration files cPanel & WHM”Installing and Configuring PostgreSQL in Ubuntu
The installation command in Ubuntu:
sudo apt-get install postgresql postgresql-client postgresql-contrib
You can install a graphical client for easy management:
sudo apt-get install pgadmin3
or
sudo apt-get install phppgadmin
To access from outside, open the configuration file (Ctrl + X to exit):
sudo nano /etc/postgresql/9.3/main/postgresql.conf
And uncomment the line:
listen_addresses = 'localhost'
In the pg_hba.conf file, we specify which addresses are allowed access:
host all all 192.168.0.1/32 md5
Restart PostgreSQL so that the changes to the configuration files take effect:
sudo service postgresql restart
Here is the password for the postgres user:
sudo -u postgres psql ALTER USER postgres with encrypted password 'PASSWORD'; CTRL+Z
An example of testing a connection from a remote computer:
psql -h СЕРВЕР -U postgres -W
If PostgreSQL is to be used with Apache2, then we’ll install the other components:
sudo apt-get install apache2 libapache2-mod-php5 php5 php5-common php5-gd php5-pgsql
Solution of the error “Using unique option prefix pass instead of password is deprecated …”
I noticed some errors coming to the root mail with the subject and the text:
Cron
/usr/bin/test -x /usr/local/cpanel/scripts/update_db_cache && /usr/local/cpanel/scripts/update_db_cache
Warning: Using unique option prefix pass instead of password is deprecated and will be removed in a future release. Please use the full name instead.
The problem lies in the file ~ / .my.cnf, that is /root/.my.cnf in my case.
In which the parameter “pass” is obsolete and must be changed to a new “password”.
For example, that’s how it was when the error occurred:
[client] user=root pass=password
Changed to password and the error disappeared:
[client] user=root password=password
See also:
Connecting to MySQL from localhost without entering a password
How to make a bootable USB flash drive with CentOS
I will describe the actions that must be performed to make a bootable USB flash drive with CentOS:
1) Download the image of CentOS (namely LiveCD, looking for it usually under the buttons in “via Torrent”) from the official site
https://www.centos.org/download/
Old versions can be downloaded for example here (in isos folders)
http://vault.centos.org
2) Download Universal USB Installer
pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/
files.ixnfo.com/Soft/Universal-USB-Installer-2.0.1.4.zip
3) We connect the USB flash drive to the computer and run the Universal USB Installer. In it, we agree with the license agreement by clicking “I Agree“, in the second window where:
“Step 1:” choose “CentOS“,
“Step 2” click “Browse” and point to the downloaded iso-image CentOS.
“Step 3:” select the letter of the flash drive, tick the “Format” (this will re-partition the file system table and erase all the data on the USB flash drive).
4) Click “Create” and we are waiting for the completion of the process.
How to save a POST request to a file
I’ll give a couple of examples of saving the data of the incoming POST request to a file:
Option 1
$s = implode('|', $_POST); exec('echo $s >> file.txt');
Option 2
file_put_contents('file.txt', json_encode($_POST));
Example of option 2 with a specific parameter:
file_put_contents('file.txt', json_encode($_POST['parameter']));
How to delete an Instagram account
It took somehow to delete the account in Instagram.
I went to Instagram with a login and password, clicked on the right at the top of the account name, then chose “EDIT PROFILE” and at the very bottom there was a link “Temporarily block my account”, which does not delete, but only blocks it with the possibility of recovery in the future, here’s a direct link to the lock
https://www.instagram.com/accounts/remove/request/temporary/
But you do not need to block it, but completely delete it, so you can find the link to delete below in the “CONFIDENTIALITY”. Go to which you need to specify the reason for the deletion and confirm the deletion.
Actually here is a direct link to delete the account in Instagram so do not search – https://www.instagram.com/accounts/remove/request/permanent/
Solution of error “PHP Deprecated: Function split() is deprecated in”
This error can occur after upgrading PHP to a newer version.
Actually, the split() function is deprecated with PHP 5.3.x and must be replaced in the code with preg_split()
Done.
How to Disable Plugin Updates in WordPress
You can disable the update of a particular or all WordPress plug-ins in several ways, I’ll describe several of them:
Continue reading “How to Disable Plugin Updates in WordPress”Hard Reset Lenovo A390t
I will describe a few simple steps to perform a hard reset on the Lenovo A390t:
1) Turn off the device if it is turned on.
2) Press the volume button up and the power button simultaneously, wait for the Recovery menu to appear.
3) In the recovery menu, press the volume down/up button to highlight “Wipe data/factory reset” and select it by pressing the power button, then select “Wipe cache partion” in the same way.
4) When cleaning is complete, the recovery menu will appear again, in which we select “reboot system now“, after which the device will reboot.
Done.
Using SED (Stream EDitor)
SED (Stream EDitor) — streaming text editor and programming language.
An excellent tool to convert outgoing text data in any convenient form.
For example, several times wrote a table of online mac-addresses, which were taken from the switch, were checked with billing and were output with such data as address, ID, login, etc ..
For example, a script that receives SNMP macros from the L3 of the HP 5800 switch and saves them in a text document in a column, thanks to the SED, unnecessary data is deleted, and spaces are replaced with a colon:
#!/bin/bash rm /var/www/mac.txt snmpwalk -v 2c -c community 192.168.1.50 .1.3.6.1.2.1.17.4.3 -O v|sed -e "s/.*Hex-STRING: //g" -e "s/ /:/g" -e "s/.$//" -e "/INTEGER/d" > /var/www/mac.txt
Here are a few more examples of using SED.
Output only values after Hex-STRING:
sed -e 's/.*Hex-STRING: //g'
Colon whitespace replacement:
sed -e 's/ /:/g'
Delete the last line:
sed -e sed 's/.$//'
Delete the last character:
sed -e 's/.$//'
Removing a string containing INTEGER:
sed -e '/INTEGER/d'
Removing lines in file.txt where ABCD occurs:
sed -i '/^ABCD/ d' file.txt
Example of deleting the third line in the file file.txt and deleting 4 lines starting from line 7:
sed -i '3,1d' file.txt sed -i '7,4d' file.txt
Enumerate the lines in file.txt:
sed = file.txt | sed 'N;s/\n/\t/'
Outputting only rows from 5-10:
sed -n 5,10p file.txt
The built-in help can be obtained by the command:
man sed