TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #121 · 20 јул.

Регулярно требуется преобразовать какой-либо текст в максимально совместимый текст для URL, имени файла, имени объекта в каком-то софте и тд. Требования совместимости простые: в тексте должны быть только допустимые символы. Обычно это a-z, 0-9 и "_" или "-". То есть, только прописные буквы латинского алфавита и цифры (как пример). Допустим, нам нужно название статьи в блоге преобразовать в slug для добавления его в URL этой статьи. Как это лучше всего сделать? В Django по умолчанию есть готовая функция slugify для таких случаев. Но я её никогда не использую. Почему? Потому что её недостаточно! Приведём пример >>> from django.utils.text import slugify >>> slugify('This is a Title') 'this-is-a-title' Пока всё отлично >>> slugify('This is a "Title!"') 'this-is-a-title' Спец символы удалились, всё хорошо. >>> slugify('Это заголовок статьи') '' Вот и приехали 😢. Если текст не английский то буквы просто игнорируются. Можно это поправить >>> slugify('Это заголовок статьи', allow_unicode=True) 'это-заголовок-статьи' Но тогда мы не вписываемся в условие. У нас появилась кириллица в тексте. Так как я часто пишу сайты для русскоязычных пользователей эта проблема весьма актуальна. Я не использую стандартную функцию и всегда пишу свою. Оригинал я не беру в расчёт и пишу полностью свою функцию. И так, по порядку: 🔸1. Исходный текст: >>> text = 'Мой заголовок №10 😁!' Взял специально посложней со специальными символами. 🔸2. Транслит Необходимо сделать транслит всех символов в латиницу. Здесь очень выручает библиотека unidecode. Помимо простого транслита кириллицы в латиницу она умеет преобразовывать спец символы и иероглифы в текстовые аналоги. from unidecode import unidecode >>> unidecode("Ñ Σ ® µ ¶ ¼ 月 山") 'N S (r) u P 1/4 Yue Shan' Очень крутая библиотека, советую👍 В нашем случае получаем такое преобразование: >>> text = unidecode(text) >>> print(text) 'Moi zagolovok No. 10 !' Отличный транслит. Смайл просто удалился, хотя я ждал что-то вроде :). Ну и ладно, всë равно невалидные символы. А еще наш код уже поддерживает любой язык, будь то хинди или корейский. 🔸4. Фильтр символов Unidecode не занимается фильтрацией по недопустимым символам. Это мы делаем в следующем шаге через regex. Просто заменим все символы на "_" если они вне указанного диапазона. >>> text = re.sub(r'[^a-zA-Z0-9]+', '_', text) >>> print(text) 'Moi_zagolovok_No_10_' Символ "+" в паттерне выручает когда несколько недопустимых символов идут рядом. Все они заменяются на один символ "_". 🔸5. Slugify Осталось удалить лишние символы по краям и сделать нижний регистр >>> text = text.strip('_').lower() >>> print(text) 'moi_zagolovok_no_10' Получаем отличный slug! 😎 🌎 Полный код в виде функции. ______________ PS. Проверку что в строке остался хоть один допустимый символ я бы вынес в отдельную функцию. #libs#tricks#django

Резултати

Пронајдени 15 слични објави

Пребарај: #fdroid

当前筛选 #fdroid清除筛选
Android Broadcast

@android_broadcast · Post #9537 · 01.10.2025 г., 12:50

🤯F-Droid выражает протест против обязательной верификации всех разработчиков Разработчики альтернативного магазина open-source приложений выражают обеспокоенность тем, что обязательная верификация для распространения приложений на устройствах, сертифицированных Google, негативно влияет на творчество. Но у меня сразу ряд вопросов: 👉 Какие проблемы это создает для распространения через F-Droid? 👉 Исходный код и все авторы приложения из F-Droid известны 👉 Авторы гарантируют что софт настоящий и без трекинга, то в чем суть подтверждения авторства? Официальное заявление можно найти тут #android#googleplay#fdroid

Libreware

@libreware · Post #1562 · 27.02.2026 г., 22:15

❌#Fdroid security problems ⁨https://privsec.dev/posts/android/f-droid-security-issues⁩⁩ ⁨⁨https://xcancel.com/GrapheneOS/status/1883895255142932816 https://xcancel.com/GrapheneOS/status/1497272529223917575 ⁨⁨https://gitlab.com/ironfox-oss/IronFox/-/issues/7⁩⁩ ⁨⁨https://github.com/obfusk/fdroid-fakesigner-poc⁩⁩ ⁨⁨https://github.com/CatimaLoyalty/Android/issues/2608⁩⁩ ⁨⁨https://gitlab.com/fdroid/admin/-/issues/593⁩⁩ ⁨⁨https://discuss.grapheneos.org/d/15490-f-droid-or-obtainium⁩⁩ ⁨⁨https://m.youtube.com/watch?v=IzpVI4zaso0⁩⁩ ⁨⁨https://m.youtube.com/watch?v=lAbgeJau3eE⁩⁩ ⁨⁨https://m.youtube.com/watch?v=FFz57zNR_M0⁩⁩ ⁨⁨https://m.youtube.com/watch?v=IAoCfrqx⁩⁩ #fd

Hashtags

Android Broadcast

@android_broadcast · Post #8658 · 08.02.2025 г., 09:20

🐱Buckwheat (на русском звучит "Гречка") - это приложение с открытым исходным кодом, которое помогает вам тратить деньги разумно. Запись каждой статьи расходов приводит вас в чувства и дает представление о том, сколько и как вы можете потратить. Стек технологий: Jetpack Compose, KotlinX Coroutines, Room, Dagger + Hilt, Coil 🛒 Вы можете установить приложение из Google Play #android#opensource#пример#fdroid#compose

Libreware

@libreware · Post #1429 · 06.03.2025 г., 22:42

A post from the developer of #WireGuard on the severe #security flaws and lack of trustworthiness of #FDroid: https://bsky.app/profile/grapheneos.org/post/3lgq7wqwzpk26 The Bluesky link has GrapheneOS posts explaining https://gitlab.com/fdroid/fdroiddata/-/issues/3110#note_1613430404 Stuff here but not to the point like the Bluesky link https://discuss.grapheneos.org/d/18731-f-droid-vulnerability-allows-bypassing-certificate-pinning/

Momogram

@momogram_update · Post #1183 · 21.02.2026 г., 09:25

Keep Android Open https://keepandroidopen.org https://f-droid.org/2026/02/20/twif.html During out talks with F-Droid users at FOSDEM26 we were baffled to learn most were relieved that #Google has canceled their plans to lock-down #Android. Why baffled? Because no such thing actually happened, the plans announced last August are still scheduled to take place. We see a battle of PR campaigns and whomever has the last post out remains in the media memory as the truth, and having journalists just copy/paste Google posts serves no one. But Google said… Said what? That there’s a magical “advanced flow”? Did you see it? Did anyone experience it? When is it scheduled to be released? Was it part of Android 16 QPR2 in December? Of 16 QPR3 Beta 2.1 last week? Of Android 17 Beta 1? No? That’s the issue… As time marches on people were left with the impression that everything was done, fixed, Google “wasn’t evil” after all, this time, yay! While we all have bad memories of “banners” as the dreaded ad delivery medium of the Internet, after FOSDEM we decided that we have to raise the issue back and have everyone, who cares about Android as an open platform, informed that we are running out of time until Google becomes the gate-keeper of all users devices. Hence, the website and starting today our clients, with the updates of F-Droid and F-Droid Basic, feature a banner that reminds everyone how little time we have and how to voice their concerns to whatever local authority is able to understand the dangers of this path Android is led to. We are not alone in our fight, IzzyOnDroid added a banner too, more #FDroid clients will add the warning banner soon and other app downloaders, like Obtainium, already have an in-app warning dialogue. #why

Libreware

@libreware · Post #1561 · 27.02.2026 г., 22:14

#Droidify#Fdroid client Added SHA256 for signature verification (Long press on Sync icon to refresh index) https://github.com/Droid-ify/client/releases Many more android app stores at https://t.me/Libreware/1132 and #apk@LibreWare Tell us your favorite or any missing ones

Libreware

@libreware · Post #997 · 27.10.2021 г., 00:22

Droid-ify Unofficial F-Droid client with Material UI based on Foxy-Droid Features: Material F-Droid style No cards or inappropriate animations Fast repository syncing Standard Android components and minimal dependencies https://github.com/iamlooker/Droid-ify/ Download: https://github.com/Iamlooker/Droid-ify/releases https://f-droid.org/packages/com.looker.droidify https://android.izzysoft.de/repo/apk/com.looker.droidify 📡@NoGoolag📡@Libreware #droidify#apk#fdroid

Libreware

@libreware · Post #1080 · 04.05.2022 г., 07:29

Neo Store A quick material F-Droid client 🎨 Material F-Droid style 🎯 No cards or inappropriate animations ✈️ Fast repository syncing 🔧 Standard Android components and minimal dependencies https://github.com/NeoApplications/Neo-Store Channel @neo_applications Group @neo_android_store #neostore#fdroid#apk

Libreware

@libreware · Post #1553 · 21.02.2026 г., 05:39

Keep Android Open https://keepandroidopen.org https://f-droid.org/2026/02/20/twif.html During out talks with F-Droid users at FOSDEM26 we were baffled to learn most were relieved that #Google has canceled their plans to lock-down #Android. Why baffled? Because no such thing actually happened, the plans announced last August are still scheduled to take place. We see a battle of PR campaigns and whomever has the last post out remains in the media memory as the truth, and having journalists just copy/paste Google posts serves no one. But Google said… Said what? That there’s a magical “advanced flow”? Did you see it? Did anyone experience it? When is it scheduled to be released? Was it part of Android 16 QPR2 in December? Of 16 QPR3 Beta 2.1 last week? Of Android 17 Beta 1? No? That’s the issue… As time marches on people were left with the impression that everything was done, fixed, Google “wasn’t evil” after all, this time, yay! While we all have bad memories of “banners” as the dreaded ad delivery medium of the Internet, after FOSDEM we decided that we have to raise the issue back and have everyone, who cares about Android as an open platform, informed that we are running out of time until Google becomes the gate-keeper of all users devices. Hence, the website and starting today our clients, with the updates of F-Droid and F-Droid Basic, feature a banner that reminds everyone how little time we have and how to voice their concerns to whatever local authority is able to understand the dangers of this path Android is led to. We are not alone in our fight, IzzyOnDroid added a banner too, more #FDroid clients will add the warning banner soon and other app downloaders, like Obtainium, already have an in-app warning dialogue. #why

Libreware

@libreware · Post #894 · 04.02.2021 г., 18:15

PCAPdroid Capture traffic on Android devices and send the PCAP via UDP without root PCAPdroid lets you capture the Android traffic and analyze it remotely (e.g. via Wireshark). The traffic can be easily captured on a remote PC via an UDP socket. 💡 Features: ✅ Capture apps traffic without root privileges ✅ Send captured traffic via UDP ✅ Download the traffic PCAP via the integrated HTTP server ✅ Show captured traffic real time statistics ✅ Apply a filter to only capture traffic for the selected app ✅ Decrypt HTTPS/TLS traffic via a remote mitmproxy https://f-droid.org/packages/com.emanuelef.remote_capture/ #PCAPdroid#android#fdroid#app

Libreware

@libreware · Post #904 · 19.02.2021 г., 19:25

[email protected] - Drizzle in my repo today with 2 new apps. Most prominently: Watomatic – to help those of you still stuck at WhatsApp to leave that s(t)inking ship without being afraid "nobody can find you": it sends auto-responses to everyone writing you, telling them you've left and where to look. So: no more excuses, here's your door! https://apt.izzysoft.de/fdroid/index/apk/com.parishod.watomatic​ Further running: SpaceXFollower (SpaceX events, facts, statistics) and Auxio, a nice music player, added yesterday. Enjoy #foss#Android#apps with #fdroid!

12
ПретходнаСтраница 1 од 2Следна