Don’t include external JS for custom content example Goodreads

On many websites, you can have content embedded from other sites and one way that most external sites will offer will be to include a script that’s hosted on their website.

But if all that script does is including some remote content there are better ways to get that, that will provide customizations and performance.

For example, the website Goodreads offers such an embed JS with a list of the latest books you read, and you must include the script where you want the content to be shown. But that has a long list of drawbacks: the script uses the old API document.write, is a script and can’t be loaded in AMP, the scripts write very old style HTML with tags like center, attributes like border which again is not valid AMP, then also that script will be loaded for every request, so you’ll have one additional request. View full article

Build a Simple WordPress commenting system on top of the native one with AMP support

There are a lot of commenting system plugins out there but most of them come with a cost, and sometimes just building a simple WordPress commenting system on top of the native commenting system can be enough.

The main features of this system will be:

  • Comments will be only loaded if the user clicks a button
  • Comments will be submitted and fetched by JS
  • Comments will have paginations fetched by JS
  • Comments will have some JS interactivity
  • Comments will have the reply feature enabled
  • The comment system will have an AMP implementation
  • The comment system will have a no JS implementation
  • Comments will work the same on AMP with our own script

The first thing will have to do for our system is to make some custom REST API for the JS to fetch. View full article

WSL1 became unusable – I finally switched to WSL2

When WSL1 first appeared I was pretty excited, a lot of people claim today that because WSL, Windows is the best platform for developers, personally these days I think any OS from the big three can act as a perfect developing platform since many of us use docker anyway.

But back to WSL1, what I really liked was the WSL1 was Cygwin on steroids a kind of “Linux Wine”, and that meant a lot from the perspective of OS development, because it really was a step in the direction of merging OSes rather than have yet another virtual machine.

I mostly switched to WSL2 because I grew tired of my applications crashing because WSL1 was missing some implementations, and I thought I wasted enough time on workarounds like setting Nginx buffering to off, replacing libc libraries, replace system binaries with custom scripts, replacing apt repos with custom ones, adding custom apt repos, changing network IP version preference, avoid using Unix sockets and so on and on(but even TCP wasn’t fully implemented, constantly you could bumble into TCP_INFO error), so basically WSL1 is not extremely stable. View full article

Flask PyWebCamWebMonitor Web App

A couple months ago I made a Python-Vue app ( Flask PyWebCamWebMonitor ) for controlling webcams(live view/record/stream) attached to a Linux host.

It’s pretty straight forward you use pip3 to install it then you install it as a system service or you start it manually with a command that is registered on the system automatically after you installed the python package.

When I first released it I tested it on a Linux X86 host but my intention was to make the app work even on the smallest dev boards, so a few days ago I tried to install it on orange pi zero.

As expected I encountered some problems first, the problem is that installing NumPy which is a dependency of OpenCV which is a dependency of my app, was complicated because the NumPy was not available for arm devices and when you tried to install it from building it you ran out of memory and the kernel killed the building process, you can activate a swap, and increase your /tmp size to overcome these limitations but it is simple just to install NumPy from the APT repo with apt install python3-NumPy, that you don’t have to needlessly wait. View full article