Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в Python в модуле re.
Чтобы указать флаг для компилятора нам надо указать его после передаваемой строки. Например, добавляем флаг для игнорирования переноса строки.
pattern = re.compile(r"(\w+)+")
words = pattern.search(text, re.DOTALL)
А как указать несколько флагов? Ведь явно будут ситуации когда нам потребуется больше одного. Кто читал посты по битовые операторы уже понял как.
pattern.search(text, re.DOTALL | re.VERBOSE)
А теперь смотрим исходники, что находится в этих атрибутах?
Не удивительно, степени двойки. Почему? Потому что каждое следующее значение это сдвиг единицы влево.
>>> for n in [1, 2, 4, 8, 16, 32, 64, 128, 256]:
>>>
print(bin(n))
0b1
0b10
0b100
0b1000
0b10000
0b100000
0b1000000
0b10000000
0b100000000
Чтобы было понятней, давайте напишем тоже самое но иначе, добавим ведущие нули:
000000001
000000010
000000100
000001000
000010000
000100000
001000000
010000000
100000000
Не понятно что тут происходит? Читай три поста про битовые операторы начиная с этого ➡️https://t.me/pythonotes/45
В общем, это пример применения побитовых операций в самом Python.
Теперь вы знаете Python еще немного лучше)
#tricks#regex#libs
📰 KaOS 2026.03 Released With Major Move Away From systemd Components
KaOS 2026.03 removes systemd-boot and mkinitcpio, adopts Limine and Dracut, and introduces a new Niri-based desktop environment.
🔗 Source: https://linuxiac.com/kaos-2026-03-released-with-major-move-away-from-systemd-components/
#systemd
📰Someone Forked Systemd to Strip Out Its Age Verification Support
The project removes the birthDate field systemd added last week in response to age verification laws.
🔗 Source: https://feed.itsfoss.com/link/24361/17304579/systemd-fork-strips-out-age-verification
#systemd
📰 SysV Init 3.16 Released With Cleanups, Improved systemd Unit To SysV Script Conversion
For any holdouts still running SysV Init instead of systemd or other alternatives like OpenRC, SysV Init 3.16 is out as the first release in a half-year and bringing a few refinements...
🔗 Source: https://www.phoronix.com/news/SysV-Init-3.16
#systemd
📰 systemd 260-rc1 Released: New "mstack" Feature, System V Service Scripts No Longer Supported
The first release candidate of systemd 260 is now available for testing. Systemd 260 finally does away with System V service scripts support. Also notable to systemd 260 is the work around the new "mstack" feature...
🔗 Source: https://www.phoronix.com/news/systemd-260-rc1
#systemd
systemd birthDate Merge: Corporate Filings & Governance Failure
Investigation pulled Amutable's founding documents from the German Handelsregister
The corporate filings show three equal shareholders, no outside investors, and self-dealing exemptions that let any founder sign contracts between the company and their own personal entities All three founders were employed at Microsoft when they signed the founding deed. A hidden shareholders' agreement referenced three times in the Articles of Association but never filed publicly governs economic rights, IP assignment, and vesting terms the public cannot see.
Three decisions put the birthDate field into #systemd. Each was made by someone with a direct financial interest in the outcome No one disclosed those interests. systemd has no conflict-of-interest policy, no steering committee, no community veto, and no disclosure requirements. The project that boots every major Linux distribution has less formal governance than a typical mid-size open source project.
Lennart Poettering intends to replace "sudo" with #systemd's run0. Here's a quick PoC to demonstrate root permission hijacking by exploiting the fact "systemd-run" (the basis of uid0/run0, the sudo replacer) creates a user owned pty for communication with the new "root" process.
This isn't the only bug of course, it's not possible on Linux to read the environment of a root owned process but as systemd creates a service in the system slice, you can query D-BUS and learn sensitive information passed to the process env, such as API keys or other secrets.
https://fixupx.com/hackerfantastic/status/1785495587514638559
Nitter mirror: https://xcancel.com/hackerfantastic/status/1785495587514638559
📰 The One Trick That Made Immutable Linux Easier For Me
There's a systemd utility that lets you "inject" tools into a read-only OS at runtime, without rebooting the system. Here's my exploration.
🔗 Source: https://feed.itsfoss.com/link/24361/17309280/systemd-sysext
#linux#systemd
📰 Fish 4.6 Shell Brings Support For Recent systemd Environment Variables
Fish 4.6 released today as the newest version of this Rust-based interactive shell for Linux and other platforms...
🔗 Source: https://www.phoronix.com/news/Fish-4.6-Released
#systemd#linux
📰Systemd Introduces Birth Date Support for Upcoming Linux Desktop Age Controls
A recent systemd update introduces birth date storage, supporting ongoing efforts to implement age-based access controls in the Linux desktop stack.
🔗 Source: https://linuxiac.com/systemd-introduces-birth-date-support-for-upcoming-linux-desktop-age-controls/
#linux#systemd
📰 systemd 260-rc2 Released With More Changes
Last week marked the release of systemd 260-rc1 with a new "mstack" feature, a new "FANCY_NAME" field for os-release, dropping System V service script support, and other changes. Out today is systemd 260-rc2 release with more changes in further working its way toward a stable release for empowering 2026 Linux distributions...
🔗 Source: https://www.phoronix.com/news/systemd-260-rc2
#systemd#linux
📰 New to Linux? These 4 systemd Tools Help You Fix Common Issues
Stop guessing, start investigating. Here are 4 systemd tools that make Linux troubleshooting easy.
🔗 Source: https://itsfoss.com/systemd-troubleshoot-tools/
#linux#systemd
📰 Inside the Systemd Age Verification Debate: Developer Responds to Criticism
A single pull request turned a quiet open source contributor into the unlikely target of one of the Linux community's most heated controversies. We interacted with Dylan Taylor to hear his side of the story.
🔗 Source: https://feed.itsfoss.com/link/24361/17306445/dylan-taylor-systemd-controversy
#systemd#linux#opensource