Go 語言延遲初始化 -Lazy Initialization- 最佳實踐
簡介—–在有些資源初始化成本很高,甚至在某些代碼路徑未觸發根本沒有必要初始化,可以將對象的創建、配置等耗時操作推遲到真正需要使用時才執行。延遲初始化實現———-2.1 sync.Oncesync.Once 是 Go 標準庫提供的線程安全初始化工具,確保初始化代碼只執行一次:var ( resource MyResource // 需要延遲初始化的資源 once ⌘ Read more
🧮 USERS:1 FEEDS:2 TWTS:1384 ARCHIVED:87784 CACHE:2673 FOLLOWERS:22 FOLLOWING:14
🧮 USERS:1 FEEDS:2 TWTS:1383 ARCHIVED:87781 CACHE:2688 FOLLOWERS:22 FOLLOWING:14
We’re entering the “too hot to think”-season in 3, 2, 1 … and we’re live!
🧮 USERS:1 FEEDS:2 TWTS:1382 ARCHIVED:87766 CACHE:2684 FOLLOWERS:22 FOLLOWING:14
🧮 USERS:1 FEEDS:2 TWTS:1381 ARCHIVED:87759 CACHE:2692 FOLLOWERS:22 FOLLOWING:14
🧮 USERS:1 FEEDS:2 TWTS:1380 ARCHIVED:87754 CACHE:2699 FOLLOWERS:22 FOLLOWING:14
🧮 USERS:1 FEEDS:2 TWTS:1379 ARCHIVED:87753 CACHE:2701 FOLLOWERS:22 FOLLOWING:14
Saw this on Mastodon:
https://racingbunny.com/@mookie/114718466149264471
18 rules of Software Engineering
- You will regret complexity when on-call
- Stop falling in love with your own code
- Everything is a trade-off. There’s no “best” 3. Every line of code you write is a liability 4. Document your decisions and designs
- Everyone hates code they didn’t write
- Don’t use unnecessary dependencies
- Coding standards prevent arguments
- Write meaningful commit messages
- Don’t ever stop learning new things
- Code reviews spread knowledge
- Always build for maintainability
- Ask for help when you’re stuck
- Fix root causes, not symptoms
- Software is never completed
- Estimates are not promises
- Ship early, iterate often
- Keep. It. Simple.
Solid list, even though 14 is up for debate in my opinion: Software can be completed. You have a use case / problem, you solve that problem, done. Your software is completed now. There might still be bugs and they should be fixed – but this doesn’t “add” to the program. Don’t use “software is never done” as an excuse to keep adding and adding stuff to your code.
🧮 USERS:1 FEEDS:2 TWTS:1378 ARCHIVED:87729 CACHE:2694 FOLLOWERS:22 FOLLOWING:14
@aelaraji@aelaraji.com I use Alt+. all the time, it’s great. 👌
FWIW, another thing I often use is !! to recall the entire previous command line:
$ find -iname '*foo*'
./This is a foo file.txt
$ cat "$(!!)"
cat "$(find -iname '*foo*')"
This is just a test.
Yep!
Or:
$ ls -al subdir
ls: cannot open directory 'subdir': Permission denied
$ sudo !!
sudo ls -al subdir
total 0
drwx------ 2 root root 60 Jun 20 19:39 .
drwx------ 7 jess jess 360 Jun 20 19:39 ..
-rw-r--r-- 1 root root 0 Jun 20 19:39 nothing-to-see
🧮 USERS:1 FEEDS:2 TWTS:1377 ARCHIVED:87719 CACHE:2687 FOLLOWERS:22 FOLLOWING:14
@prologic@twtxt.net … or just bullshit.
I’m Alex, COO at ColdIQ. Built a $4.5M ARR business in under 2 years.
Some “C-level” guy telling people what to do, yeah, I have my doubts.
🧮 USERS:1 FEEDS:2 TWTS:1376 ARCHIVED:87698 CACHE:2671 FOLLOWERS:22 FOLLOWING:14
🧮 USERS:1 FEEDS:2 TWTS:1375 ARCHIVED:87691 CACHE:2671 FOLLOWERS:22 FOLLOWING:14
Nourished By Time – 9 2 5
Nourished By Time follows up the song of the year with another rousing, timeless anthem from his forthcoming LP The Passionate Ones, coming in August on XL… Continue reading… ⌘ Read more
🧮 USERS:1 FEEDS:2 TWTS:1374 ARCHIVED:87681 CACHE:2671 FOLLOWERS:22 FOLLOWING:14
🧮 USERS:1 FEEDS:2 TWTS:1373 ARCHIVED:87677 CACHE:2676 FOLLOWERS:22 FOLLOWING:14
🧮 USERS:1 FEEDS:2 TWTS:1372 ARCHIVED:87663 CACHE:2673 FOLLOWERS:22 FOLLOWING:14
🧮 USERS:1 FEEDS:2 TWTS:1371 ARCHIVED:87645 CACHE:2661 FOLLOWERS:22 FOLLOWING:14
🧮 USERS:1 FEEDS:2 TWTS:1370 ARCHIVED:87623 CACHE:2689 FOLLOWERS:22 FOLLOWING:14
🧮 USERS:1 FEEDS:2 TWTS:1369 ARCHIVED:87615 CACHE:2689 FOLLOWERS:22 FOLLOWING:14
🧮 USERS:1 FEEDS:2 TWTS:1368 ARCHIVED:87599 CACHE:2702 FOLLOWERS:22 FOLLOWING:14
New oil and gas fields incompatible with Paris climate goals
Opening any new North Sea oil and gas fields is incompatible with achieving the Paris Climate Agreement goals of limiting warming to 1.5°C or holding warming to “well below 2°C” relative to preindustrial levels, finds a new report published by UCL academics. ⌘ Read more
Practical study material OSWP Part 2: WPA2-MGT Walkthrough ⌘ Read more
OSWE Web Hacking Tips (IPPSEC): Java Reversing href=”https://we.loveprivacy.club/search?q=%232”>#2** ⌘ Read more
Radxa UFS/eMMC Module Reader and Storage Solution Enables Fast Flashing and Scalable Embedded Storage
Radxa’s UFS/eMMC Module Reader is a compact USB 3.0 adapter for flashing OS images, accessing firmware, and transferring large files. It supports both eMMC v5.0 and UFS 2.1 modules with speeds up to 5 Gbps The adapter is compatible with eMMC and UFS modules from Radxa, and also works with modules from platforms like PINE64 and […] ⌘ Read more
Illicit tobacco crop worth $4.4m discovered near Shepparton after tip-off
Authorities seize a 20-tonne crop of mature tobacco being grown on 2.4 hectares, an area equivalent to more than 450 tennis courts, in Victoria’s north. ⌘ Read more
🧮 USERS:1 FEEDS:2 TWTS:1367 ARCHIVED:87591 CACHE:2698 FOLLOWERS:22 FOLLOWING:14
Carney to announce Canada’s defence spending will hit NATO’s target of 2% of GDP this fiscal year, sources say ⌘ Read more
Nintendo Switch 2 Hacked in 48 Hours — But Here’s Why It’s Just the Beginning
A harmless green line on the screen may have just opened the floodgates for hackers — inside the first real exploit on Nintendo’ … ⌘ Read more
🧮 USERS:1 FEEDS:2 TWTS:1366 ARCHIVED:87588 CACHE:2696 FOLLOWERS:22 FOLLOWING:14
CH32H417 Dual-Core RISC-V MCU Offers USB, Ethernet, and SerDes Support
WCH’s new CH32H417 microcontroller introduces a dual-core RISC-V architecture designed for embedded applications requiring high-speed connectivity and peripheral integration. It is built on the Qingke V5F core running at 400 MHz and the V3F core at 144 MHz. The microcontroller supports USB 3.2 Gen 1 with a 5Gbps PHY and dual-role host/device functionality, along with […] ⌘ Read more
Pepper Jack Cheese joined my family 2 days ago. She plays fetch! ⌘ Read more
🧮 USERS:1 FEEDS:2 TWTS:1365 ARCHIVED:87577 CACHE:2688 FOLLOWERS:22 FOLLOWING:14
First usermode exploit and more: Nintendo Switch 2 had a busy (hacking) week for its launch
Comments ⌘ Read more
Download Borderlands 2 for Mac FREE This Weekend on Steam
If you’re a Mac gamer and you love free games, you won’t want to miss out on this deal; Borderlands 2, the classic popular first-person action RPG shooter, is free to download this weekend on Steam (until the morning of June 8 at 10am PDT). And because it’s on Steam, you’ll be able to play … Read More ⌘ Read more
My 2 rescue cat loving each other ⌘ Read more
She’s literally so fuckin small (she’s 2 and fully grown) ⌘ Read more
Luckfox Pico 2 Adopts RP2350A Dual-Core MCU, Launches at $3.99
Luckfox has released the Pico 2 Micro Development Board, a compact module designed around Raspberry Pi’s RP2350A microcontroller. It targets embedded development and experimentation with both ARM and RISC-V instruction sets, offering dual-core support in a low-cost form factor. The RP2350A microcontroller from Raspberry Pi features a dual-core, dual-architecture design, offering both ARM Cortex-M33 and […] ⌘ Read more
🧮 USERS:1 FEEDS:2 TWTS:1364 ARCHIVED:87566 CACHE:2680 FOLLOWERS:22 FOLLOWING:14
Deals: AirPods Pro 2 for $169, AirPods 4 for $99, Apple Watch 10 for $299
Father’s Day is coming up, so perhaps you’re shopping for that, or shopping for yourself. In any event, don’t miss these great deals from Amazon, whether you’re getting a gift for yourself or a loved one. With great deals on the latest iPad mini, MacBook Air, AirPods, AirPods Pro with Hearing Aid functionality, Apple Watch, … [Read More](https://osxdaily.com/2025/06/06/deals-airpods-pro-2-for … ⌘ Read more
10 Incredibly Specific Oreo Facts You’ll Think About at 2 A.M.
You’ve twisted them, dunked them, and crumbled them into milkshakes—but odds are, you don’t really know Oreos. Behind the world’s best-selling cookie is a labyrinth of marketing manipulation, food science secrets, and flavor experiments so bizarre they’re hidden from the public. These aren’t your standard “Oreo was invented in 1912” trivia tidbits. These are the […]
The post [10 Incredibly Specific Oreo Facts … ⌘ Read more
🧮 USERS:1 FEEDS:2 TWTS:1363 ARCHIVED:87556 CACHE:2682 FOLLOWERS:22 FOLLOWING:14
Vue 團隊正式發佈!未來 Vue 也能寫後端啦!
前言–大家好,我是林三心,用最通俗易懂的話講最難的知識點是我的座右銘,基礎是進階的前提是我的初心~背景需求—-最近,我遇到了一個需求:有兩個頁面,每個頁面各自連接到一個獨立的WebSocket。這兩個頁面能夠通過WebSocket相互影響。爲了更好地理解需求,以下是兩個頁面的簡化版本:頁面 1 和頁面 2 的需求:頁面 1:當點擊更新按鈕時,頁面 1 的數值加 1,同時頁面 2 的數值變爲頁 ⌘ Read more
🧮 USERS:1 FEEDS:2 TWTS:1362 ARCHIVED:87544 CACHE:2687 FOLLOWERS:22 FOLLOWING:14
PEP 794: Import Name Metadata
This PEP proposes extending the core metadata specification for Python packaging to include a new, repeatable field named Import-Name to record the import names that a project owns once installed. A new key named import-names will be added to the [project] table in pyproject.toml. This also leads to the introduction of core metadata version 2.5. ⌘ Read more
golang 每日一庫之工作流引擎 cadence
Cadence 是由 Uber 開發並開源的分佈式工作流編排引擎,旨在幫助開發者構建可擴展、可靠且具備容錯能力的分佈式應用程序。這個 Uber 當前給我發了好多打車券,還是很厚道的。特點–1. 容錯的有狀態工作流Cadence 的工作流是 “容錯的有狀態工作流”,即使在進程崩潰或服務重啓的情況下,工作流的狀態(包括局部變量、調用棧、定時器等)也能自動恢復,確保業務流程不中斷。2. 異步任務與自動 ⌘ Read more