Blocking access to the site for AI bots

To block access to your site for an AI bot, you need to write the following instruction in the .htaccess file:

Now, each bot that is specified in the instructions in brackets, when trying to scan a page of your site, will receive a 403 – Forbidden response.

In brackets, through |, you need to list the names of the bots that want to be blocked.

You can look up the names of the bots in the log file: /var/log/apache2/other_vhosts_access.log

For example, for ChatGPT there will be lines like this:

your_site.com … “GET … HTTP/1.1” 304 2798 “-” “Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ChatGPT-User/1.0; +https://openai.com/bot”

where “ChatGPT-User” is the name of the bot.

$a = &$b vs $a =& $b

Anyone who works with PHP probably knows what “assignment by reference” is.
This is an instruction like $a = &$b, which essentially means that the variable $a is a reference to the variable $b. That is, as a result:

the value 20 will be displayed, since $a simply references $b.

And such a record, in my opinion, looks logical. On the left is the variable to which we assign something, in the middle is the assignment operator “=”, on the right is what we assign – a reference to the variable $b, which, to show that this is a reference, is designated with &.

However, it turns out that there is a completely equivalent record of the same instruction, in the form:

$a =& $b;

It works completely equivalently. As a result, $a will still be a reference to $b.

But for me, such a notation is much less informative. I always get stupefied when I see the unfamiliar assignment operator “=&”, which, when written this way, is caught by the eye in the middle.

Apparently, someone finds such a notation more convenient. But what is its convenience?
I can’t understand.

ArtCards Telegram channel

For filling ArtCards with content, I am gradually mastering AI generation of pictures using neural networks.

I created a telegram channel for this matter, in which I add notes about my generations: https://t.me/ArtCards_Interplanety

I used ComfyUI as the shell, which seems to be the most advanced and versatile tool.

Those who understand neural networks are unlikely to find anything interesting in it, but for those who are just starting to get into the generation of images with neural networks, my notes may be useful.

ArtCards – removing margins using the stretch option

When using images with a transparent background, there are usually no problems with visible margins when configuring the card. However, if you use images with backgrounds and the aspect ratio of the image does not match the aspect ratio of the element in the template, unwanted margins may appear. In this case, you can use the “stretch” function to scale the image relative to the template element so that the margins do not appear.

Removing the “Passing coroutines is forbidden, use tasks explicitly” error when using aioschedule in Python 3.11

In Python, the aioschedule library is often used to execute tasks at certain intervals, for example, when developing Telegram bots.

Unfortunately, the aioschedule package has not been updated for several years and has lost compatibility with the latest versions of Python. When used in Python 3.11, an error is thrown at the time of tasks execution

Passing coroutines is forbidden, use tasks explicitly.

Checking if list A is in list B

To chek if list A is completely included in list B – all elements of list A are present in list B, we can use the “superset” and “subset” methods of the standard Python “set” class.

Converting lists to sets also allows us not to worry about checking for duplicates if they exist in the compared lists.

subset

The “subset” method acts on a smaller set and checks if it is in a larger set.

HTML-CSS: Creating a fixed-width column on the right side of the page

When designing an HTML page, sometimes it is necessary to make a fixed-width sidebar on the right side of the page with dynamically filling all the remaining space on the left.

 

It is easiest to make this using the markup with tables, but it is quite possible with common “<div>” elements as well.

How to get the Discord channel Webhook URL

What is a “Webhook URL” in Discord and what is it for?

A Webhook URL is an address link that points to the server channel in Discord.

It looks like this:

You can send POST requests to this URL to automatically create posts in this Discord channel.

It is a powerful tool that can be used, for example, for newsletters on a channel, or cross-posting from social networks.