Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
The maximum number of chat folders for premium users was increased
Based on the latest information received from the Telegram configuration, the folder creation limit for ⭐️Premium Users has been increased from 20 to 30.
This limit has not changed for non-premium users and these users can create a maximum of 10 folders.
#Premium | #Configuration
👉The TG Times
Increased cooldown time to activate Stealth Mode in stories
According to the latest changes in Telegram's configuration files, the minimum time interval for reactivating Stealth Mode for stories was increased from one hour to 3 hours.
This means that after activating it, Stealth Mode will be activated for you for 25 minutes, and you can activate Stealth Mode again after 2 hours and 35 minutes.
#Stories | #Configuration
👉The TG Times
Archive and Save Stories in Channels
As with personal stories, channel stories are archived after they expire, and subscribers to that channel will no longer be able to access them unless you post them to the channel profile.
#Stories | #Configuration
👉The TG Times
Limits for posting stories
In the configuration of the Telegram server, It was found that there are restrictions for premium and non-premium users.
Information specified from this configuration:
- Weekly limit for posting stories:
⭐️ Premium users : 70 stories
👤 Non-premium users : 7 stories
- Monthly limit for posting stories:
⭐️ Premium users : 300 stories
👤 Non-premium users : 30 stories
It is possible that other restrictions will be applied to Telegram stories, but as soon as it becomes clear, we will inform you through the channel.
#Stories | #Configuration
👉The TG Times
The maximum number of chat folders for premium users was increased
Based on the latest information received from the Telegram configuration, the folder creation limit for ⭐️Premium Users has been increased from 20 to 30.
This limit has not changed for non-premium users and these users can create a maximum of 10 folders.
#Premium | #Configuration
👉The TG Times
Stories on Channels and Boosts
According to the latest Telegram configuration information received, Telegram is launching the boosting system for channels. Boost allows channel subscribers to vote for their favorite channels. By boosting channels, some features may be activated, such as posting stories in the channel. But the exact features and rewards based on this system are still unknown
As it turns out, only premium users have the ability to boost channels, and these users will only have one boost available at no extra cost. Users can only choose which channel to boost once a day.
#Stories | #Beta | #Configuration
👉The TG Times
📰Giveaways are getting ready to be activated on the main server
Telegram beta configuration updates in each version make the Giveaways more complete and prepare for official presentation.
This system was active for some to receive more boosts from the first release of the beta version 10.2.0 on the test server.
Also, multiple boosts and the possibility of boosting more by giving a Premium gift are not activated on the main server, which can be related to the Giveaways.
It is expected that this system will be launched soon in the next updates for the main server.
Configurations by @tgcrawl
#Giveaways | #Configuration
👉The TG Times
📰Get more boosts by gifting Telegram Premium!
In the latest information received from Telegram beta configuration by @tgcrawl, it was found that if you buy a Premium subscription for yourself, you will receive one available boost and if you gift a subscription to one of your contacts, you will receive some additional boosts.
When you want to boost another channel while you have already boosted another channel, this message will be displayed to you:
"To Boost **1%$s** reassign a previous boost or gift Telegram Premium to a friend to get **%2$d** additional boosts"
This is an example
#Boost | #Configuration | #Beta v.10.2
👉The TG Times
Interesting step-by-step guide about design and development API with Docker containers, Swarm cluster and Traefik (HTTP reverse proxy and load balancer).
In this article you’ll know how to configure the Traefik in the Docker environment with 3 following nodes: one manager and two workers
#architecture#configuration#docker#microservices
https://hackernoon.com/architecting-a-highly-scalable-golang-api-with-docker-swarm-traefik-875d1871cc1f?source=linkShare-b636419a57de-1517171008
#go#config#config_loader#configuration#configuration_file#configuration_management#etcd_client#go#golang#golang_package#s3_bucket#toml#viper#yaml
koanf is a lightweight Go library to load config from files (JSON, YAML, TOML), env vars, flags, S3, Vault and more, merging them easily with dot-path keys like "app.server.port". Install core with `go get github.com/knadh/koanf/v2`, add providers/parsers as needed. It's a cleaner Viper alternative with fewer dependencies and better extensibility. This saves you time by simplifying config in apps, letting you override values flexibly without bloat or forced orders.
https://github.com/knadh/koanf