WordPress

Python
Base64, PyScript, and WordPress

In a recent post, I found that WordPress misinterpreted indents and returned errors when I tried to run PyScript codes on it. It might be because WordPress detoxes the codes to turning them unfunctional for security reasons. So, I converted them into base64 to evade WordPress' watch. Code with no indent First, a code with no indent. I converted the above code into base64 and pasted into the py-script tag as src. The first two lines urge the browser to import the PyScript program. Results ↑No problem with hello world. Code with indents Next, a code with indents. Its result is what I am interested in. The above code was […]

Read more
Python
Brief Review of PyScript on WordPress

Anaconda has introduced PyScript at PyCon US 2022. It enables client-side execution of Python codes in web browsers, and they say it is already compatible with Numpy, Pandas, and other third-party modules. I gave it a quick try on WordPress. Environment WordPress 5.9.3 Lightning 14.20.3 Safari 15.4 or Google Chrome 101.0.4951.54 MacOS 12.3.1 Apple M1 Pro Examples The custom HTML block seems to be the best place for PyScript codes. Some simplest codes work there. Results print("Hello, world!") Here comes the greeting! However, PysScript looks to override the default CSS settings, and the bold headings on this page are no longer bold. Similarly, bullet points of a list are missing. Whether […]

Read more
WordPress
Simplest Way to Block Spam Comments

My WordPress posts would be swamped with dozens of spam comments, all from Russia. With just a few clicks, I have successfully blocked them to regain my peace of mind. It is extremely simple if your website is proxied by Cloudflare. Log in to your Cloudflare account, go to Security > Firewall Rules, set up a rule like below, and block access from the country(-ies) altogether. Unless your website is about Russian liberal arts or the like, you will lose practically nothing by doing so.

Read more