Можно ли в 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
Stop Trusting #Messaging Apps! Build Your Own Global #Meshtastic#MQTT Network - Explained Simply
Most messaging apps promise privacy, but very few let you control the infrastructure behind your conversations.
https://rumble.com/v75rxrg
#im#mesh#p2p
There's a newcomer to the Mesh world
In this video we introduce #Meshcore, a powerful open-source, text-based encrypted mesh-radio system built on #LoRa hardware—perfect for off-grid communications on your homestead or preparedness setup. #Meshtastic fans will find Meshcore instantly familiar — a low-cost, open-source way to stay connected when the internet and cell service aren’t available. But Meshcore takes a few different paths, and we’ll break it down in plain English.
https://www.youtube.com/watch?v=iaFltojJrAc
Edit: not fully foss ⚠️
MeshCore is not entirely open source, which seems odd for an off-grid decentralized communications framework. Some parts are open, but the official clients (the mobile apps, web app, and T-Deck firmware) are not
https://hackaday.com/2025/12/06/lessons-learned-after-trying-meshcore-for-off-grid-text-messaging/
#mesh#p2p#im
Unboxing Elecrow ThinkNode M1 & M2 | #Meshtastic Setup, Field Test, Review & Off-Grid Comms Breakdown
https://rumble.com/v6v1uk1
In this video, I take you deep into the world of off-grid communication as I unbox and test two brand-new devices from Elecrow: the ThinkNode M1 and ThinkNode M2. These tools come pre-installed with Meshtastic firmware and are built for encrypted, decentralized communication — no SIM card, no Wi-Fi, and no cell towers required. Whether you’re prepping for a blackout, building a resilient mesh network, or just exploring survival tech, this video is packed with everything you need to know.
We start with a full unboxing of both devices, breaking down what makes each unique. The ThinkNode M1 is powered by the nRF52840 chip and includes a GPS module for location tracking, a 1.54” sunlight-readable EPD screen, and a 1200mAh battery built to last over 48 hours. It’s rugged, outdoor-ready, and ideal for emergency kits or remote travel. In contrast, the ThinkNode M2 is lighter, smaller, and powered by the ESP32-S3 chip. It includes a 1.3” OLED display, Bluetooth support, a 1000mAh battery, and is better suited for modular integration or stealthy builds.
After the unboxing, I walk you through a step-by-step setup of each device using the Meshtastic mobile app. I show you how to configure them, pair with Bluetooth, and get your private mesh network up and running in minutes. From there, I run live tests to see how each device performs in real-world conditions and compare their features, form factor, and best use cases.
If you’re interested in off-grid privacy tools, these are two of the most beginner-friendly and capable devices out there right now. I also include a breakdown of which device might be better depending on your needs—whether you’re building a neighborhood mesh or planning for emergency scenarios.
Make sure to check out the official product pages using the links below. These links track monthly performance, so I appreciate your support if you use them:
👉 ThinkNode M1:
https://www.elecrow.com/thinknode-m1-meshtastic-lora-signal-transceiver-powered-by-nrf52840-with-154-screen-support-gps.html?idd=5
👉 ThinkNode M2:
https://www.elecrow.com/thinknode-m2-meshtastic-lora-signal-transceiver-powered-by-esp32-s3-with-1-3-oled-display.html?idd=5
Elecrow is also running a giveaway where you can win LoRa modules or get PCB assembly sponsorship. Don’t miss this opportunity to level up your off-grid gear for free:
https://www.elecrow.com/blog/lora-modules-giveaway-and-pcb-assembly-sponsorship.html?idd=5
These tools are more than tech — they represent freedom. In a world where networks can go dark and censorship can silence, devices like these keep people connected, informed, and in control. With Meshtastic and LoRa, you are the signal. You are the network. And it’s all open source.
If you found this helpful, drop a comment, like the video, and subscribe for more content on off-grid tech, cybersecurity gadgets, and digital autonomy. Let me know which one you’d trust in your blackout bag — the rugged M1 or the sleek, portable M2.
⸻
📡 Hashtags:
#LoRa#Meshtastic#ThinkNodeM1#ThinkNodeM2#Elecrow#OffGridCommunication#EmergencyComms#GridDown#PreppingGear#TechUnboxing#ESP32#nRF52840#SurvivalTech#MeshNetworking#DecentralizedComms#EncryptedMessaging#HamRadioAlternative#LongRangeRadio#DigitalFreedom#TacticalTech#CyberSecurity#LoRaWAN#MeshRadio#HackerTools#BlackoutReady#BugOutBag#PrivacyTech#RadioComms#DisasterPreparedness#MeshtasticSetup#FreedomThroughTech