Thursday, April 4, 2019

WordPress new post editor has encountered an unexpected error

I tried:

  • Disabled all plugins (included SEO) and browser addons.
  • Attempt recovery doesn't work. Error code.
  • Switch to other themes.

Error Code:

TypeError: Cannot read property 'show_ui' of undefined
    at https://www.milliondollarserver.com/wp-includes/js/dist/editor.min.js?ver=9.0.11:55:241342
    at i (https://www.milliondollarserver.com/wp-includes/js/dist/vendor/lodash.min.js?ver=4.17.11:6:91)
    at An.filter (https://www.milliondollarserver.com/wp-includes/js/dist/vendor/lodash.min.js?ver=4.17.11:99:338)
    at https://www.milliondollarserver.com/wp-includes/js/dist/editor.min.js?ver=9.0.11:55:241307
    at ph (https://www.milliondollarserver.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:97:88)
    at eg (https://www.milliondollarserver.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:125:307)
    at fg (https://www.milliondollarserver.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:126:168)
    at wc (https://www.milliondollarserver.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:138:237)
    at fa (https://www.milliondollarserver.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:137:115)
    at ng (https://www.milliondollarserver.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:149:69)

Environment
  • WordPress 5.1.1
  • Nginx 1.15
  • PHP-FPM 7.2
  • wp-supercache
Here is how I fix it:
#vi /etc/nginx/wp-supercache
Original:

location / {
    try_files $cachefile $uri $uri/ /index.php;
}
Changed to:
location / {
	try_files $cachefile $uri $uri/ /index.php$is_args$args;
}
Restart Nginx to apply the changes:
# sudo systemctl restart nginx
Related Bug: https://github.com/WordPress/gutenberg/issues/9912

Saturday, March 23, 2019

CREATE A LEMP STACK IN AWS EC2 by Amazon Linux 2 (LINUX, NGINX, MARIADB AND PHP 7.2)

Launch Instance: latest Amazon Linux 2 AMI



# Update Linux and install essential packages
sudo yum -y update

# Install php72 using amazon-linux-extras
sudo amazon-linux-extras install php7.2

# Install Nginx 1.12 using amazon-linux-extras
sudo amazon-linux-extras install nginx1.12

# Install mariadb using amazon-linux-extras
sudo amazon-linux-extras install lamp-mariadb10.2-php7.2
## this will install apache/httpd as well, which we don't need.
### uninstall httpd
sudo yum earse httpd httpd-tools
# install mariadb-server should be version 10.2 or higher
sudo yum install mariadb-server
To enable nginx, php-fpm and mardb services on boot:
sudo systemctl enable nginx
sudo systemctl enable php-fpm
sudo systemctl enable mariadb
To start all 3 service:
sudo systemctl start php-fpm
sudo systemctl start nginx
sudo systemctl start mariadb
sudo mysql_secure_installation

Amazon Linux 2 add fail2ban from epel

Amazon Linux team did a great work to make it easy and clean at same time.

 The epel repo is no longer enable by default like the olden days.

This keep the rpm packages as slim as possible.

To enable epel, just one command:

# sudo amazon-linux-extras install epel
# sudo yum update
# sudo yum install fail2ban

Friday, March 22, 2019

Amazon Linux 2 Systemctl commands timeout - systemd issue

A long live AWS EC2 vm gave me this when I try to check the httpd running status:
systemctl status httpd
Failed to get properties: Connection timed out
According google search: https://serverfault.com/questions/712928/systemctl-commands-timeout-when-ran-as-root I tried both:
kill -9 1
systemctl daemon-reexec
None of them works. The [reboot] only flack a bit and kick me out of system but did not really reboot. I have to run:
systemctl --force --force reboot
To force it reboot. Love systemd!

Sunday, March 10, 2019

How to reset check_mk admin password

My Windows 10 Laptop just crashed after latest Intel patch upgrade.

Forgot to save the admin password on one of the latest check_mk site I built.
su - mysite

cd etc

ls -l htpasswd

OMD[mysite]:~/etc$ ls -l htpasswd
Example: check_mk version 1.4:
lambert:!$1$042926$lmAEb.P5TAi0sZfiGyWHX.
omdadmin:M29dfyFjgy5iA
check_mk version 1.5:
automation:$1$857531$PzhNz/zMdQv8xGu68EZhD.
cmkadmin:$1$386620$Xe5mZKwrPRlzx0BvZCJM8.
htpasswd htpasswd omdadmin          # set password for user *omdadmin*

New password: 

Re-type new password:
You should be good! Have a nice day!

Monday, February 25, 2019

recommend Script to remove Windows 10 bloatware

Recommend a great Script to remove Windows 10 bloatware.

You can find it here:

https://github.com/Sycnex/Windows10Debloater

Just download the zip and run in PowerShell by right click: Windows10Debloater.ps1
If you like GUI: Windows10DebloaterGUI.ps1

PS:
  1. Appreciate Richard Newton's great work.
  2. I did not run white list, because I do not want anything except the 'Core Windows 10'.
  3. If you really really need keep some Windows 10 bloatware, please run Windows10SysPrepDebloater.ps1 before you start the main .PowerShell script.
  4. The only one I may keep is the Mail which crashed every time I check the Gmail folders.
  5. I sill using Windows 10 as my Main working OS and Outlook as my Main Email client. But not a fan of any bloatware.

Tuesday, December 11, 2018

git pull: Unable to create ORIG_HEAD.lock No space left on device

# git pull
fatal: Unable to create '/mds/mds/.git/ORIG_HEAD.lock': No space left on device

# df -h .
Filesystem                                              Size  Used Avail Use% Mounted on
/dev/disk/by-uuid/b1358fbb-dab1-482d-ab22-fa2523975c2e   16G   11G  3.9G  74% /

# df -i .
Filesystem                                              Inodes   IUsed  IFree IUse% Mounted on
/dev/disk/by-uuid/b1358fbb-dab1-482d-ab22-fa2523975c2e 1003680 1003680      0  100% /
It just to many small log files in the folder. To quick delete them:
cd yourdirectory
perl -e 'for(<*>){((stat)[9]<(unlink))}'
Reference & Thanks: https://stackoverflow.com/questions/24895502/git-pull-unable-to-create-orig-head-lock-no-space-left-on-device/25002467 https://unix.stackexchange.com/questions/37329/efficiently-delete-large-directory-containing-thousands-of-files