Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
#lua
99 is an alpha Neovim plugin for skilled coders that streamlines AI requests using OpenCode. Install via Lazy with the given Lua config, set keymaps like `<leader>9f` to fill functions, `<leader>9v` for visual AI edits (visual mode only), and `@` for cmp skill autocompletion from custom SKILL.md rules or AGENT.md files. View logs with `:lua require("99").view_logs()`. It boosts your workflow by keeping AI help inside Neovim for fast, restricted code generation without leaving your editor.
https://github.com/ThePrimeagen/99
#lua
OTClient Redemption is a flexible and complete alternative client for the game Tibia, designed to work with OTServ servers. It uses LUA scripting and CSS-like syntax for easy customization of the game interface, allowing you to create new mods and extend features. Written in modern C++20, it supports advanced graphics, sound, multi-language, and mobile platforms through OpenGL. It offers many features like shaders, animated textures, transparency, and an in-game LUA terminal. This client improves performance with multi-threading and garbage collection, and adapts smoothly to server latency for better gameplay. You benefit by having a customizable, high-performance client that enhances your Tibia experience and supports modding and mobile use.
https://github.com/mehah/otclient
#lua
Path of Building 2 is a free offline tool for planning your Path of Exile 2 character builds. It helps you calculate your damage, defenses, life, mana, and other stats accurately by including buffs, auras, and enemy resistances. You can plan your passive skill tree, add and toggle skills, and manage items by importing them directly or crafting custom gear. It supports minions, party play, and sharing builds with others. This tool saves you time and effort by showing exactly how changes affect your character, helping you create strong, optimized builds before playing. It updates automatically and works offline for convenience.
https://github.com/PathOfBuildingCommunity/PathOfBuilding-PoE2
#lua#github#neovim
Octo.nvim lets you edit and review GitHub issues, pull requests, and discussions right in Neovim. Just open with commands like `//github.com/user/repo/issues/1` or `w` to sync changes instantly. Add reactions, labels, assignees, or reviewers easily. This saves time by keeping all GitHub work in your editor—no browser switching—boosting productivity for developers managing repos.
https://github.com/pwntester/octo.nvim