Можно ли в Python создавать бинарные файлы? Конечно можно.
Для этого в Python есть следующие инструменты:
▫️ тип данных bytes и bytearray
▫️ открытие файла в режиме wb (write binary) или rb (read binary)
▫️ модуль struct
Про модуль struct поговорим в первую очередь.
Файл в формате JSON или Yaml внутри себя содержит разметку данных. Всегда можно определить где список начался а где закончился. Где записана строка а где словарь. То есть формат записи данных содержит в себе элементы разметки данных.
В binary-файле данные не имеют визуальной разметки. Это просто байты, записанные один за другим. Правила записи и чтения находятся вне файла.
Модуль struct как раз и помогает с организацией данных в таком файле с помощью определения форматов записи для разных частей файла.
Модуль struct преобразует Python-объекты в массив байт, готовый к записи в файл и имеющий определённый вид.
Для этого всегда следует указывать формат преобразования (или, как оно здесь называется - запаковки).
Формат нужен для того, чтобы выделить достаточное количество байт для записи конкретного типа объекта. В последствии с помощью того же формата будет производиться чтение.
При этом следует помнить что мы говорим о типах языка С а не Python.
Именно формат определяет, что записано в конкретном месте файла, число, строка или что-то еще.
Вот какие токены формата у нас есть.
Помимо этого, первым символом можно указать порядок байтов. На разных системах одни и те же типы данных могут записываться по-разному, поэтому желательно указать конкретный способ из доступных. Если этого не сделать, то используется символ '@', то есть нативный для текущей системы.
В строке формата мы пишем в каком порядке и какие типы собираемся преобразовать в байты.
Запакуем в байты простое число, токен "i".
>>> import struct
>>> struct.pack('=i', 10)
b'\n\x00\x00\x00'
Теперь несколько float, при этом нужно передавать элементы не массивом а последовательностью аргументов.
>>> struct.pack('=fff', 1.0, 2.5, 4.1)
b'\x00\x00\x80?\x00\x00 @33\x83@'
Вместо нескольких токенов можно просто указать нужное количество элементов перед одним токеном, результат будет тот же.
>>> struct.pack('=3f', 1.0, 2.5, 4.1)
b'\x00\x00\x80?\x00\x00 @33\x83@'
Теперь запакуем разные типы
>>> data = struct.pack('=fiQ', 1.0, 4, 100500)
я запаковал типы float, int и unsigned long long (очень большой int, на 8 байт)
b'\x00\x00\x80?\x04\x00\x00...'
Распаковка происходит аналогично, но нужно указать тот же формат, который использовался при запаковке. Результат возвращается всегда в виде кортежа.
>>> struct.unpack('=fiQ', data)
(1.0, 4, 100500)
Как видите, ничего страшного!
#lib#basic
#ReactJS
⚙️React, visualized – interaktiv o'rganish!
— React konseptlarini grafik va interaktiv tarzda o'rganing
— Props, State, Components, JSX va boshqa asosiy mavzularni vizual tarzda tushuning
— Har bir mavzu misollar va diagrammalar bilan tushuntirilgan
Sayt:react.gg/visualized
💡 Oson va qiziqarli tarzda React’ni o‘rganing!
💻@dasturlash_hayoti— dasturchilar hayoti va IT memlari aralash kanal😉
https://gist.github.com/genomics-geek/98929a9e7ba9602fed7bfa4a5a1c5c4e
Guide on how to create and set up a Dockerized web app using #Django_REST_APIs and #ReactJS
#Docker
#typescript#electron#material_you#music#music_player#netease_cloud_music#react#reactjs
Music You is a free desktop music player that lets you enjoy all the features of NetEase Cloud Music on your computer, with a modern, easy-to-use design that follows Google’s Material You style. You can log in with your phone, browse recommendations, manage your music library, listen to podcasts and radio, see lyrics (including word-by-word highlights), play local files, and access your cloud music. The app is built with React and Electron, works on Windows, macOS, and Linux, and is open source—so you can even download and modify the code yourself. This gives you a smooth, full-featured music experience right on your desktop, with regular updates and a clean, customizable interface.
https://github.com/GuMengYu/music-you
#typescript#cinny#cinnyapp#client#hacktoberfest#matrix#matrix_client#matrix_org#reactjs
Cinny is a simple, elegant, and secure Matrix messaging client with end-to-end encryption and open-source code. Use the web app at app.cinny.in, download the desktop version, or self-host easily via GitHub releases, Docker, or your webserver for full control. This lets you chat privately and modernly without relying on big tech apps, giving you privacy, customization, and easy setup on your own server for secure, ad-free messaging.
https://github.com/cinnyapp/cinny
#typescript#agent#agents#ai#assistant#assistant_chat_bots#generative_ui#js#react#reactjs#ui#ui_components
Tambo AI is a free React SDK that lets AI generate and control your app's UI from natural language chats, like showing charts or updating notes without clicks. Register components with simple Zod schemas, wrap in TamboProvider, and use hooks for streaming chats. It beats manual wiring with MCP tools, self-hosting, and templates. You save hours prototyping adaptive apps that fit every user—newbies see basics, pros get advanced views—cutting support needs and boosting speed.
https://github.com/tambo-ai/tambo
#java#distributed_systems#durable_execution#grpc#java#javascript#microservice_orchestration#orchestration_engine#orchestrator#reactjs#spring_boot#workflow_automation#workflow_engine#workflow_management#workflows
Conductor is an open-source tool that helps you manage and automate complex workflows involving many microservices and systems. It makes your workflows flexible, reliable, and scalable by handling retries, errors, and monitoring automatically. You can define workflows as code in JSON, use various task types, and manage workflows dynamically without tightly coupling services. It offers an easy-to-use web interface and supports multiple databases like Redis and MySQL. This helps you build, run, and monitor workflows efficiently, saving time and reducing errors in managing distributed applications. It also has SDKs for Java, Python, JavaScript, Go, and C# to integrate easily with your projects.
https://github.com/conductor-oss/conductor
#python#blocknotejs#collaborative#django#documentation#g2g#government#knowledge#knowledge_base#mit#mit_license#opensource#reactjs#realtime_collaboration#self_hosted#wiki#yjs
Docs is a collaborative online text editor that helps you and your team write, edit, and organize documents together in real time, even offline. It offers easy formatting, AI tools like summarizing and rephrasing, and secure sharing with controlled access. You can export documents in various formats and create structured knowledge with subpages. Docs is open source, easy to self-host, and used by public organizations, ensuring your data stays secure and private. This tool saves time, improves teamwork, and turns your notes into organized knowledge you can access anytime. It’s great for teams wanting efficient, secure, and collaborative document editing.
https://github.com/suitenumerique/docs
#python#api#bracket#brackets#docker#docusaurus#fastapi#json#mantine#nextjs#postgresql#python#react#reactjs#selfhosted#sports#tournament_bracket#tournament_manager#tournaments#web#yarn
Bracket is a tool for organizing tournaments. It supports different formats like single elimination, round-robin, and Swiss. You can create teams, add players, and manage multiple clubs with several tournaments. The system allows you to drag-and-drop matches to different courts or reschedule them. It also provides customizable dashboard pages for public viewing. This makes it easier to manage and engage with tournaments, offering more flexibility and control for organizers and participants.
https://github.com/evroon/bracket
#typescript#boilerplate#boilerplate_code#jamstack#javascript#js_boilerplate#netlify_template#next_js#next_theme#nextjs#nextjs_starter#nextjs_template#react#react_boilerplate#reactjs#starter_kit#starter_project#starter_template#tailwind_css#tailwindcss#typescript
You can quickly start a modern web project using a ready-made Next.js boilerplate that includes the latest Next.js 15 features, Tailwind CSS 4, and TypeScript. It offers built-in user authentication, multi-language support, type-safe database tools, error monitoring, AI code reviews, and security features like bot protection. The setup is easy with local and remote database options, automatic testing, and deployment guides. This saves you time and effort by providing a flexible, production-ready foundation with best practices, letting you focus on building your app instead of configuring tools and infrastructure. It also supports smooth development with live reload and VSCode integration.
https://github.com/ixartz/Next-js-Boilerplate