Inkscape extension: Batch Move Guides
The Batch Move Guides extension for the Inkscape 2D graphics editor provides the ability to simultaneously move all guides (guidelines) to the desired distance.
The Batch Move Guides extension for the Inkscape 2D graphics editor provides the ability to simultaneously move all guides (guidelines) to the desired distance.
Lately, it has become impossible to launch the Internet Explorer browser on Windows 10/11. If try to launch it, the IE browser automatically closed and launch the MS Edge browser instead of the Internet Explorer.
But if you still need to use the Internet Explorer browser, you can start it from the vbs script.
Launching the Internet Explored browser on Windows 10/11Read More »
StarIce – a simple CRM with which you can quickly create a contract with your partner from a template, add technical tasks to the contract, set a deadline for them, and receive confirmation from the partner by sending him an open link.
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.
The “subset” method acts on a smaller set and checks if it is in a larger set.
1 2 3 4 5 6 7 8 9 |
A = ['a', 'x', 'z'] A1 = ['a', 'x', 'z', 99] B = list('abcdefghijklmnopqrstuvwxyz') # ['a', 'b', ..., 'z'] print(set(A).issubset(set(B))) # True print(set(A1).issubset(set(B))) # False |
Unduplicator –Ā an online tool for finding and removing duplicate words.
This tool will help you quickly find and remove all repeated words or terms in text or in a text list, dividing it into elements according to the specified separators.
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.
HTML-CSS: Creating a fixed-width column on the right side of the pageRead More »
To get information about the operating system, on which our code is executed, we can use the “platform” module.
The system() method of this moduel returns the text name of the operating system:
1 2 3 4 5 |
import platform print(platform.system()) # Windows |
Python: get information about current operating systemRead More »
WP2D – a WordPress plugin for automatically submitting post announcements from WordPress to the Discord channel when publishing posts.
The plugin is free. You can support it on Gumroad:
A Webhook URL is an address link that points to the server channel in Discord.
It looks like this:
1 |
https://discord.com/api/webhooks/880147380966321/HycCH_DMzkD5zXASVVvj3QRXHUnxs0pxuRzSbBs_UH7p71PS_AXD002Mq |
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.
Copy Permalink to Clipboard – A WordPress plugin that adds a “to Clipboard” button next to the post link fields to the posts editor interface. Clicking on it copies the full post permalink to the clipboard.
The plugin is free. You can support or download it from Gumroad:
To make a button in the taskbar, by clicking on which all open windows will be minimized in Windows 10:
Button to minimize all windows to the taskbar in Windows 10Read More »
InputHint – JQUERY/PHP plugin that adds hints with variants of the entered text to input fields, with the possibility of their selection by the user, and filling the field with text from the selected hint.
In order to reduce the size of a long text string, for example, to minimize traffic when sending some text data over the Internet, it can be compressed before sending and unzipped after receiving. The size of transmitted data is significantly reduced in comparison with sending text strings in their original format.
To zip a text string in memory, we can use the “zlib” module.
Let’s use the “compress” function to compress the string. This function takes a byte string as an input parameter and returns the compressed byte string.
1 2 3 4 5 6 7 8 9 10 11 12 |
import zlib long_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' print('long_text', len(long_text)) long_text_compressed = zlib.compress(long_text.encode('utf-8')) print('long_text_compressed', len(long_text_compressed)) # long_text 445 # long_text_compressed 270 |
As we can see with this simplest example, the line size has been reduced by more than one and a half times.
To add a program link to the Windows Explorer (“My Computer”) context menu – we need to edit the Windows registry.
The windows registry editor must be opened with administrator rights. Now we need to make the following changes:
How to add a program link to the Windows Explorer context menuRead More »
Widget for Elementor page builder plugin for WordPress. It allows you not to show your e-mail on your pages explicitly to prevent gathering it by web-spiders and robots for spam. Visitors will see your e-mail address after clicking a “show e-mail” button.
To get the first element found in a list by some condition or None if nothing was found we can use the following construction:
1 2 3 4 |
elements_list = ['One', 'Two', 'Three'] element = next(iter([e for e in elements_list if e in ['One', 'Two']]), None) print(element) # 'One' |
With nothing found it returns None:
1 2 3 |
element = next(iter([e for e in elements_list if e in ['Four', 'Five']]), None) print(element) # None |
Some default parameters in GIMP can be set using the gimprc file.
To quickly create directories with the name equal to the current date through the Total Commander:
1 2 |
set dir_name=%date:~6,4%.%date:~3,2%.%date:~0,2% md "%1%dir_name%" |
In the first line of the script, the desired name for the directory is created in the format YYYY.MM.DD.
The second script line creates a directory with the specified name along the path passed in the input parameter %1
How to make directories with current data name in Total CommanderRead More »
To check what version of the Python interpreter is using to execute code, you can use the “version_info” command from the “sys” module:
1 2 3 4 |
import sys print(sys.version_info) # sys.version_info(major=3, minor=5, micro=2, releaselevel='final', serial=0) |
In this exampleĀ the Python version 3.5.2. is using.
Creating Windows restore points is a good way to help to restore your computer if any troubles such as virus or advertising bots infection occur.
The restore point is a systemĀ image in which its current state is recorded (settings, appearance, installed programs). By creating and saving such a point, you can return your system to the recorded state at any time.
If you have opened a suspicious mail attachment accidentally, and now advertising banners appear on your computer screen (an advertising bot has been installed in your system) – with restore points you can return the system “back to the past” before the bot infects. Restore points are not absolutely troubles panacea, but very often, a “rollback” of the system saves the situation and returns the computer to a normal working state.
The list of classes defined in the * .py file can be obtained using the built-in module “inspect”.
For example, for the “test_cls” module:
1 2 3 4 5 6 7 |
## test_cls.py class Test1: pass class Test2: pass |
we can get a list of classes with the followingĀ code:
1 2 3 4 5 6 7 8 |
## test.py import inspect classes = [cls_name for cls_name, cls_obj in inspect.getmembers(sys.modules['test_cls']) if inspect.isclass(cls_obj)] print(classes) # ['Test1', 'Test2'] |
When developing online projects, it is often necessary to save the HTML page as a document that can be used separately, for example, sent by e-mail, viewed and edited offline. A convenient way is to export the HTML page to one of the most commonly used text formats – doc.
The free open-source PHP-module “html_to_doc” can be used to export the HTML page to the DOC document. It can convert the HTML to the DOC document, which will be correctly processed by the text editor MS Word. If the HTML page includes images, they will be embedded in the DOC document.
The PHP module can be downloaded from https://github.com/Korchy/html_to_doc
If we have a list:
1 |
my_list = ['one', 'two', 'three', 'four'] |
in order to go through the elements of this list in pairs from the current to the next, we can use the following code:
1 2 |
for first, next in zip(my_list, my_list[1:]): print(first, next) |
Results:
1 2 3 |
one two two three three four |
Some functions take in their parameters a variable number of arguments *args, for example, theĀ itertools.product function.
1 2 3 |
list(itertools.product(['a', 'b'], [1, 2])) # [('a', 1), ('a', 2), ('b', 1), ('b', 2)] |
In order to pass the list as the parameters to this function, we need to use the * operator:
1 2 3 4 5 |
my_list = [['a', 'b'], [1, 2]] list(itertools.product(*my_list)) # [('a', 1), ('a', 2), ('b', 1), ('b', 2)] |
Conversion of a string with both individual numbers and ranges of numbers to the list of integer values can be made as follows:
For example a line:
1 |
src = '1, 3-5, 8' |
Split the line by comma delimiter:
1 |
linearr = [s.strip() for s in re.split(r'[,;]+| ,', src) if s] |
Let’s split the resulting list into two lists. In the first list, we put only the individual values. In the second – the values got from the ranges of numbers.
1 2 |
linearrframes = [int(i) for i in linearr if '-' not in i] linearrdiapasones = sum([list(range(int(i.split('-')[0]), int(i.split('-')[1]) + 1)) for i in linearr if '-' in i], []) |
Combine the lists into one and drop the duplicate values.
1 2 |
linearrframes.extend(linearrdiapasones) print(list(set(linearrframes))) |
Complete code:
1 2 3 4 5 6 7 8 9 |
src = '1, 3-5, 8' print(src) linearr = [s.strip() for s in re.split(r'[,;]+| ,', src) if s] linearrframes = [int(i) for i in linearr if '-' not in i] linearrdiapasones = sum([list(range(int(i.split('-')[0]), int(i.split('-')[1]) + 1)) for i in linearr if '-' in i], []) linearrframes.extend(linearrdiapasones) print(list(set(linearrframes))) # '1, 3-5, 8' # [1, 3, 4, 5, 8] |