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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #32 · 7 фев.

Скорее всего уже слышали, что складывать строки через + это плохая практика. Падение производительности, и всё такое. Без лишних слов, давайте измерять: from timeit import timeit def t1(): # складываем 10 строк через + из переменной t = 'text' for _ in range(1000): s = t + t + t + t + t + t + t + t + t def t2(): # склеиваем список строк через метод join arr = ['text'] * 10 for _ in range(1000): s = ''.join(arr) def t3(): # складываем через + но не из переменной а непосредственно инлайн объекты for _ in range(1000): s = 'text' + 'text' + 'text' + ... # всего 10 раз Теперь каждую строку склейки запустим по 10М раз >>> timeit(t1, number=10000) 0.21951690399964718 >>> timeit(t2, number=10000) 1.4978306379998685 >>> timeit(t3, number=10000) 0.2213820789993406 Хм, а нам говорили что через "+" это плохо и медленно ))) 😁 Тут стоит учитывать, что речь идёт о склейке множества длинных строк. Давайте изменим условия: def t4(): t = 'text'*100 for _ in range(1000): s = t + t + t + t + t + t + t + t + t def t5(): arr = ['text'*100] * 10 for _ in range(1000): s = ''.join(arr) def t6(): for _ in range(1000): s = 'text'*100 + 'text'*100 + ... # всего 10 раз >>> timeit(t4, number=10000) 12.795130728000004 >>> timeit(t5, number=10000) 2.642637542999182 >>> timeit(t6, number=10000) 0.2184546610005782 Вот, уже другой разговор, сразу видна разница, в среднем в 6 раз. Но погодите, почему последний тест t6() по скорости такой же как и t3()? Ведь строки теперь в 100 раз длиннее! Это вопросы оптимизации кода, какие простые изменения ускоряют или замедляют выполнение программы. Мы столкнулись с примером обхода обращения к переменной. Например, именно так работает директива #define в С++, во время компиляции подставляя значение переменной вместо ссылки на неё. В Python это тоже работает, но часто ли вы сможете встретить такой способ работы со строками? К сожалению, способ почти только теоретический. В целом, тесты показали то, что мы хотели. Делаем выводы самостоятельно. Полный листинг 🌍 #tricks

Резултати

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

Пребарај: #wireguard

当前筛选 #wireguard清除筛选
机场鉴赏 _(:з)∠)_

@AirportAnalysis · Post #349 · 24.08.2022 г., 03:36

#Glados 机场协议: #Trojan#Vmess#Wireguard 有无审计: 有,屏蔽轮子等大部分具有政治色彩的网站。 机场套餐: https://t.me/AirportRoster/16 描述: 一个很神奇的机场,经常送30天Basic套餐的抵扣码,提供edu优惠,免费使用一年。pro套餐提供 #Wireguard 类型节点

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/

GitHub Trends

@githubtrending · Post #14902 · 03.07.2025 г., 00:00

#go#tailscale#tailscale_control_server#tailscale_server#wireguard Headscale is an open-source, self-hosted alternative to the Tailscale control server, letting you create your own private VPN network using Wireguard technology. It supports key Tailscale features like node registration, DNS, file sharing (Taildrop), access control lists (ACLs), and more, making it ideal for personal or small group use. By running Headscale yourself, you gain full control over your network without relying on Tailscale’s servers, enhancing privacy and customization. You can manage access precisely with ACLs, tag devices for group policies, and use modern VPN benefits like NAT traversal and secure connections between your devices[1][3][5]. This helps you securely connect and control your devices in a private network tailored to your needs. https://github.com/juanfont/headscale

Cool Scripts

@cool_scripts · Post #843 · 08.06.2025 г., 01:52

🔗Sub-Store 中各种 WireGuard 输入/输出格式的说明 🆕 更新了部分格式的示例 但是具体实操还是以相关的规范为准 ⚠ 不要使用 Shadowrocket 来导出 URI 然后作为输入导入。这样导出的 WireGuard URI 不是标准的 URI 😭原消息 🤭Sub-Store 合集 🥰#Sub-Store #SubStore#节点#订阅#本地节点#本地订阅#示例#WireGuard

GitHub Trends

@githubtrending · Post #14789 · 05.06.2025 г., 11:30

#go#golang#mesh#mesh_networks#nat_traversal#netbird#vpn#wireguard#wireguard_vpn#wiretrustee#zero_trust_network_access NetBird lets you quickly set up a secure private network for your organization or home without needing to configure complex firewall rules, open ports, or manage VPN gateways. It uses direct peer-to-peer connections based on WireGuard, so your devices connect to each other securely and efficiently, bypassing the need for a central server. You get strong security with features like access control, activity logging, and support for single sign-on, all managed from a simple web interface. This means you can connect and protect your devices anywhere, with minimal setup and maintenance, making remote access and network management much easier[2][1][5]. https://github.com/netbirdio/netbird

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