@LinghaoCh · Post #794 · 23.08.2022 г., 05:05
https://nft.storage/blog/post/2022-04-29-gateways-and-gatekeepers/ nice read about running IPFS public gateway #ipfs
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #397 · 12 ное.
Использование Pydantic сегодня стало нормой, и это правильно. Но иногда на ревью вижу, что используют его не всегда корректно. Например, метод BaseModel.model_dump() по умолчанию не преобразует стандартные типы, такие как datetime, UUID или Decimal, в простой сериализуемый для JSON вид. Тогда пишут кастмоный сериализатор для этих типов чтобы функция json.dump() не падала с ошибкой. import uuid from datetime import datetime from decimal import Decimal from uuid import UUID from pydantic import BaseModel class MyModel(BaseModel): id: UUID date: datetime value: Decimal obj = MyModel( id=uuid.uuid4(), date=datetime.now(), value='1.23' ) print(obj.model_dump()) # не подходит для json.dump # { # 'id': UUID('4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1'), # 'date': datetime.datetime(2025, 12, 12, 12, 12, 12, 111111), # 'value': Decimal('1.23') # } # добавляем свой кастомный сериализатор json.dumps(obj.model_dump(), cls=MySerializer) # { # 'id': '4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1', # 'date': '2025-12-12T12:12:12.111111', # 'value': '1.23' # } В данном случае класс MySerializer обрабатывает datetime, UUID и Decimal. Например так: class MySerializer(json.JSONEncoder): def default(self, o): if isinstance(o, Decimal): return str(o) elif isinstance(o, datetime): return o.isoformat() elif isinstance(o, UUID): return str(o) return super().default(o) Специально для тех, кто всё еще так делает - в этом нет необходимости! Pydantic может это сделать сам, просто нужно добавить параметр mode="json". json.dumps(obj.model_dump(mode="json")) # { # 'id': '4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1', # 'date': '2012-12-12T12:12:12.111111', # 'value': '1.23' # } #pydantic#libs
Пребарај: #ipfs
@LinghaoCh · Post #794 · 23.08.2022 г., 05:05
https://nft.storage/blog/post/2022-04-29-gateways-and-gatekeepers/ nice read about running IPFS public gateway #ipfs
Hashtags
@libreware · Post #1463 · 10.06.2025 г., 18:31
Quiet v5.1.2 => https://tryquiet.org/ Quiet is an alternative to team chat apps like Slack, Discord, and Element that does not require trusting a central server or running one's own. In Quiet, all data syncs directly between a team's devices over Tor with no server required. NOTE: #Quietis not audited and should not be used when privacy and security are critical. It lacks basic features and probably won't replace your Slack or Discord yet. That said, it works surprisingly well and we use it daily as a Slack replacement. => https://github.com/TryQuiet/quiet/releases/tag/%40quiet/desktop%405.1.2 => https://github.com/TryQuiet/quiet/releases/tag/%40quiet/mobile%405.1.2 via @dcntr #Tor#IPFS
@githubtrending · Post #15268 · 04.11.2025 г., 12:00
#go#blockchain#cloudvpn#golang#golang_library#holepunch#ipfs#ipfs_blockchain#kubernetes#libp2p#mesh#mesh_networks#nat#networking#p2p#p2pvpn#tunnel#vpn EdgeVPN lets you create secure, decentralized private networks using peer-to-peer (p2p) connections without relying on central servers. It can build a VPN that automatically assigns IPs, includes a small DNS server, and protects your network even if tokens leak. You can also use it as a reverse proxy to share TCP services or send files securely over p2p without a VPN connection. It works well for edge devices and development, especially behind NATs, and can be integrated into your own Go programs. This helps you connect devices easily and securely across different networks without complex setup or infrastructure. https://github.com/mudler/edgevpn