Posts

Showing posts from 2022

[Solved]AWS ECR keep waiting: --profile is created using aws configure --profile

Reference:  https://stackoverflow.com/a/70453287/1802483 Problem:  You are trying to push a docker image to ECR While you use the command provided by AWS and show "Login successfully" when running this command: `aws ecr get-login-password --region <your_region> | docker login --username AWS --password-stdin <aws-account-id>.dkr.ecr.<your-region>.amazonaws.com`, you still saw "Waiting" or "Preparing" when you run `docker push` Possible reason and solution: Chances are you are using multiple AWS accounts You need to "login" to correct AWS ECR account when you run `aws ecr get-login-password` If you read the link above, you would see a parameter called `--profile` `--profile` is actually created using `aws configure --profile <your_profile_name>` i.e. To push to your ECR using correct account, you need to create a new profile by running `aws configure --profile <your_new_profile_name>` To create a new profile, you need

PHP Ratel class in Drupal 7 - Ratel is a spam bot, Remove it.

Here is what I found: We have a Drupal 7 website that has a frontend that load very slowly (> 15 seconds per load, sometimes).  A performance problem. It looks like it is trying to call some remote URL/APIs that causes the timeout problem. Our colleague did a research by installing a PHP profiling tool called xhprof to do profiling on the page. It turns out that there is a PHP class called "Ratel" that takes quite a long time to execute. However, even if we are doing a code-scan, we can't even see a file that contains the word "Ratel" Thanks to  this article , and this gist , it turns out that there is a SEO spam bot that is executed ONLY when you are login to the site. In other words, you will see this performance problem more likely when you are logging in to Drupal. I recommend you to read the article above. I wonder, this is not just affecting Drupal, but mainly on Wordpress, as mentioned in the article above.  Here is how to solve: Once I know how this

[Solved] cannot import name contextfilter from jinja2

Image
As of this writing (24/5/2022), Jupyter notebook triggered an error when I open an .ipynb.   cannot import name 'contextfilter' from 'jinja2' But it is ok if I just list all the files in jupyter. Open the same .ipynb in JupyterLab is OK.  But I want to use Notebook. Here is what I did - Update Jupyter Notebook to 6.4.11 - Update nbconvert to 6.4.4 - Update nbclient to 0.5.13 I did it in Anaconda Navigator 3.  Here is the screenshot: Hope it helps someone.

How to generate .crt file from scratch using puttygen under windows

This passage will be short and to the point, as most basic info can be found online.  I just point out the necessary info.  Here are the steps: Download and install puttygen, then generate a public/private key pair. Reference: https://www.ssh.com/academy/ssh/putty/windows/puttygen You should have two .ppk files: one for private key and one for public key.   Convert your .ppk private key file to base64/pem format.  You can name it either in .pem or .key.  They are both referring to the same thing.   Reference: https://www.tbs-certificates.co.uk/FAQ/en/putty-ppk-vers-openssl-openssh.html You should have 1 .pem (or .key) file now, generated from your private key. Generate a 10 years .crt file with the following command: openssl req -new -x509 -key my_private.pem -out my_cert.pem -days 3650 -subj "/C=HK/ST=HK/L=HK/O=MyCompany/OU=My_organization/CN=mysite.com" You should have a my_cert.pem file now Convert your .pem cert to .crt cert using this command: openssl crl2pkcs7 -nocrl -c

[Solve] Cloudflare MX record - SMTP Mail Server Connection Timeout

Situation: - You enable Cloudflare on your domain - You cannot send email out from your domain.  Error: (Connection) timeout. - You are sure that the server is running OK. Problems: - In Cloudflare DNS, there is an "A" record with name = "mail", the proxy status is set to "Proxied" Solution: Please check the following: - In Cloudflare DNS, there is a "MX" record, make sure name is "@" (or called root), and "content" is your mail server domain name. In Cloudflare, it will convert your @ to <your_domain>.com automatically.  And your "content" would be something like mail.abcde.com. Proxy status needs to be "DNS Only" - There should be another "A" record, "name" is "mail", make sure your Proxy status is set to "DNS Only", not "Proxied". Update and test again.  It should work. -- Hope it helps someone.