Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
#svelte
Foundry Local lets you run powerful AI models directly on your own computer without needing an Azure subscription or internet connection. This means your data stays private and secure because everything happens locally on your device. It automatically picks the best model version for your hardware, whether you have a GPU, NPU, or just a CPU, ensuring fast and efficient performance. You can easily install it on Windows or macOS, run models via simple commands, and integrate AI into your apps using SDKs for Python, C#, or JavaScript. This gives you full control, reduces costs, and speeds up AI tasks without relying on the cloud.
https://github.com/microsoft/Foundry-Local
#typescript#svelte#sveltekit#tailwindcss#tauri
Epicenter is a free, open-source set of local-first apps that let you own and control your data by storing everything—notes, transcripts, chats—in one simple folder using plain text and SQLite. You can use any AI model you want, customize tools, and access your data anywhere without relying on cloud services. Key apps include Whispering, which transcribes your speech locally, and epicenter.sh, a personal assistant that helps you search and interact with your data. This setup gives you privacy, flexibility, and full control over your information, avoiding locked, siloed apps and data traps. It’s great for anyone who values data ownership and open software.
https://github.com/epicenter-so/epicenter
#typescript#chatgpt#hacktoberfest#huggingface#llm#svelte#svelte_kit#sveltekit#tailwindcss#typescript
Chat UI is an open-source chat interface built with SvelteKit that lets you easily connect to different AI language models using any service that works with the OpenAI API format, such as Hugging Face, llama.cpp, Ollama, or OpenRouter[5]. You can quickly set it up on your computer by cloning the project, setting a few environment variables (like your API key and database connection), and running simple commands to start the app—no need to be an expert[5]. The main benefit is that you get a modern, customizable chat app that works with many AI models, making it simple to experiment, build, and share your own AI-powered chat experiences without starting from scratch.
https://github.com/huggingface/chat-ui
#python#agplv3#education#flashcards#foreign_language#hacktoberfest#hacktoberfest2022#language_learning#python#second_language_acquisition#spaced_repetition#svelte
LibreLingo is a free, community-driven language-learning platform offering courses like Spanish, German, and French through interactive exercises, spaced repetition, and progress tracking across devices, while allowing users to contribute and modify content for a collaborative learning experience[1][4][5].
https://github.com/kantord/LibreLingo
#typescript#ai#ai_chatbot#angular#chat#chatbot#chatgpt#cohere#component#files#huggingface#image#nextjs#openai#react#react_chatbot#solid#speech#svelte#vue
Deep Chat is an easy-to-add AI chat tool for your website that connects with popular AI services like ChatGPT and HuggingFace or your own custom APIs using just one line of code. It supports text, voice input, speech-to-text, text-to-speech, file sharing, webcam photos, and audio recording, making conversations more interactive. You can customize everything from avatars to message styles and run small AI models directly in the browser without servers. It works with major web frameworks and offers features like local message storage and focus mode for a modern chat experience. This helps you quickly add a powerful, flexible AI chatbot that fits your needs and improves user engagement.
https://github.com/OvidijusParsiunas/deep-chat
#svelte#component#component_library#components#css#css_components#css_framework#daisyui#design_pattern#design_system#design_systems#postcss#svelte#tailwind#tailwind_css#tailwindcss#ui_design#ui_framework#ui_kit#ui_library#ui_pattern
daisyUI is a popular, free, and open-source component library for Tailwind CSS. It helps you build faster by providing useful class names for common UI elements like cards and calendars. This means you write less code and can focus on designing your interface more efficiently. daisyUI is also very customizable and works well with Next.js, adding no extra JavaScript to your projects, which keeps them fast and efficient. Overall, using daisyUI simplifies your development process and makes your projects more maintainable.
https://github.com/saadeghi/daisyui