Searching txt.sour.is

Twts matching #GO
Sort by: Newest, Oldest, Most Relevant

Go 包構建:專家也未必瞭解的文件選擇細節
在 Go 語言開發中,包(package)是代碼組織的基本單位 [1],也是基本的構建單元。Go 編譯器會將每個包構建成一個目標文件 (.a),然後通過鏈接器將這些目標文件鏈接在一起,形成最終的可執行程序。儘管 Go 包的構建過程看似簡單,但實際上蘊含着許多值得深入瞭解的細節。例如,當我們執行 go build 命令時,Go 編譯器是如何選擇需要編譯的源文件的?你可能會回答:“不就是通過文件名中的 ⌘ Read more

⤋ Read More
In-reply-to » @aelaraji icons at the top are badly organised while on mobile. About the speed, that’s using a shoddy PHP code, it would be slow even when running in a quantum computer. :’-D

Hehe, although it isn’t a fancy language PHP has improved a lot since the old PHP 5 days ¯_(ツ)_/¯ It’s 3 to 5 times slower than Go, so I think that’s not too bad

⤋ Read More

Go 語言實現守護進程的技術詳解
引言–在後端開發中, 守護進程 (Daemon) 是一個非常重要的概念。它是一個在後臺運行的長期存在的進程, 不受終端控制。本文將詳細介紹如何使用 Go 語言實現守護進程, 並探討其中的關鍵技術點。什麼是守護進程?——–守護進程具有以下特徵:在後臺運行 與終端會話無關 通常在系統啓動時啓動, 在系統關閉時關閉 沒有控制終端 作爲服務運行 守護進程的啓 ⌘ Read more

⤋ Read More

Go sync-Cond:最容易被忽視的同步機制
引言在探討 Go 語言中的同步機制時,大多數開發者都熟悉 sync.Mutex 和 sync.RWMutex。然而,還有一個強大但經常被忽視的同步原語:sync.Cond。本文將詳細介紹 sync.Cond,解釋它的工作原理,並通過實際示例說明其應用場景。什麼是 sync.Cond?當一個 goroutine 需要等待一些特定的事情發生時,例如一些共享數據發生變化,它就會 “阻塞”,這意味着它只是 ⌘ Read more

⤋ Read More

eBPF on Go
本篇內容是根據 2021 年 10 月份#201 eBPF and Go[1] 音頻錄製內容的整理與翻譯eBPF(已有 7 年曆史)是一個可以在 Linux 內核中運行代碼的沙箱。它最初是一種構建防火牆的技術,隨着時間的推移不斷髮展,包含一系列新功能。本期大家討論了 eBPF 的起源及其工作原理,並深入研究了一些實際用例。雖然 eBPF 程序本身不是用 Go(更像 C)編寫的,但我們將瞭解如何從 ⌘ Read more

⤋ Read More

Monero Tech meeting scheduled for 25 November 2024 1800 UTC
The next Monero Tech meeting is scheduled to take place on Monday, November 25 2024 at 18:00 UTC, in the #no-wallet-left-behind 1 IRC-Libera/Matrix channels:

Based on the opinions given here2 I decided to go back to the No Wallet Left Behind Matrix room and IRC channel for the next i.e. coming Monday’s meeting, and to not contiune to hold meetings like the last one in the -dev Matrix room and IRC channel.

This meeting’s c … ⌘ Read more

⤋ Read More

One of the things I’m going to work on next (maybe today, we’ll see how much time there’s left in the day) is being able to load up old conver …
One of the things I’m going to work on next ( maybe today, we’ll see how much time there’s left in the day) is being able to load up old conversations ( fallen off the cache) like this one. ⌘ Read more

⤋ Read More

使用 go-jsonstruct 快速生成 Go 結構體,支持 JSON 或 YAML!
在 Go 語言開發中,我們經常需要處理 JSON 或 YAML 格式的數據。爲了方便地解析和操作這些數據,通常會定義相應的 Go 結構體與之對應。然而,手動編寫這些結構體定義可能會非常繁瑣,尤其是在處理複雜數據結構時。go-jsonstruct 工具應運而生!它可以幫助我們自動生成 Go 結構體定義,從而節省時間和精力,提高開發效率。本文將深入探討 go-jsonstruct 的功能、使用方法以及 ⌘ Read more

⤋ Read More

Go 項目實戰 - API 路由的分模塊管理
隨着項目開發的迭代,我們寫的接口往往會越來越多,如果都把 API 的路由寫到一個文件裏,那麼整個路由文件就會變得又亂又長,所以我們最好在項目開始階段就給路由的分模塊管理做好規劃。今天這個文章給大家介紹一下 Web 項目 API 路由的分模塊管理,我們的項目使用的是 Gin 框架,但基本上所有的 Web 框架都能按照這個方式來分模塊管理 API 接口的路由。 一些路由管理混亂的例子——– ⌘ Read more

⤋ Read More

Go 併發控制:sync-Once 詳解
在 Go 語言的併發編程中,常常會遇到需要確保某個操作僅執行一次的場景。sync.Once 是 Go 標準庫中的一個簡單而強大的工具,專門用於解決這種需求。本文將深入解析 sync.Once 的使用方法和原理,幫助你更好地理解 sync.Once 在併發控制中的用法。sync.Oncesync.Once 是 Go 語言 sync 包中的一種同步原語。它可以確保一個操作(通常是一個函數)在程序的生命 ⌘ Read more

⤋ Read More

Go 編譯的幾個細節,連專家也要停下來想想
在 Go 開發中,編譯相關的問題看似簡單,但實則蘊含許多細節。有時,即使是 Go 專家也需要停下來,花時間思考答案或親自驗證。本文將通過幾個具體問題,和大家一起探討 Go 編譯過程中的一些你可能之前未曾關注的細節。 注:本文示例使用的環境爲 Go 1.23.0、Linux Kernel 3.10.0 和 CentOS 7.9。Go 編譯默認採用靜態鏈接還是動態鏈接?————— ⌘ Read more

⤋ Read More

Go 中祕而不宣的數據結構 CacheLine:精細優化
在現代多核處理器中,高效的緩存機制極大地提升了程序性能,而 “僞共享” 問題卻常常導致緩存機制的低效。背景----- cacheline 本文中有時又叫做 緩存行在現代多核處理器中,三級緩存通常分爲三級:L1、L2 和 L3,每一級緩存的大小、速度和共享方式都不同:L1 緩存:這是速度最快的緩存,通常每個 CPU 核心都有獨立的 L1 緩存。L1 緩存分爲兩個部分:一個用於存儲指令(L1I),另 ⌘ Read more

⤋ Read More

用 Go 語言如何實現將中文轉化爲拼音
有這麼一個需求:新用戶入職 創建一系列賬號比較麻煩,打算通過接口傳入姓名進行初始化。想把姓名轉化成拼音。因爲有些賬號即需要中文也需要英文。下面看看用 Go 語言如何去解決的。要將用戶的姓名轉換爲拼音,可以使用 Go 語言的第三方庫,比如 github.com/mozillazg/go-pinyin,這是一個流行的庫,專門用來將漢字轉換爲拼音。你可以通過它生成拼音格式的英文名稱,用於初始化賬戶時的多 ⌘ Read more

⤋ Read More

只改變一個字符就能使 Golang 程序提速 42-
虎哥來聊聊怎麼用一個小小的改動,給你的 Golang 代碼提速 42%!很多時候,程序性能優化就是這樣:只要動一個字符,就可能帶來出人意料的提升。今天咱們就從切片傳遞優化、變量聲明優化和字符串拼接優化入手,看看怎麼改動這麼一個字符能讓 Golang 飛起來!🚀切片傳遞優化先來說說切片。切片在 Go 語言中用得特別多,因爲它們既靈活又方便。然而,切片的傳遞會帶來性能問題,尤其是當切片非常大時。原始代 ⌘ Read more

⤋ Read More

(#j4tvqyq) @slashdot When are we going to resign ourselves to a position of not achieving AGI and so-called AI in the first place? Hmmm 🧐 Fun …
@slashdot @feeds.twtxt.net When are we going to resign ourselves to a position of not achieving AGI and so-called AI in the first place? Hmmm 🧐 Fundamentally I don’t think we understand how the human brain works or what it means to be a “conscious free thinking being” – I’m not convinced we’ll figure th … ⌘ Read more

⤋ Read More

MoneroKon 2025 event to be held June 20-22 in Prague at La Fabrika/Second Culture
The fifth edition of the Monero Konferenco 1 annual meeting is set2 to take place place in Prague, Czech Republic on June 20-22 at the La Fabrika/Second Culture 3 venue (previously known as Paralelni Polis):

Save the date: MoneroKon will be held 20th - 22nd June 2025 [..] Sign up to our mailing list to be notified when tickets go on sale

The previous conference was also held in Pragu … ⌘ Read more

⤋ Read More
In-reply-to » Righto, @eapl.me, ta for the writeup. Here we go. :-)

@eapl.me@eapl.me here are my replies (somewhat similar to Lyse’s and James’)

  1. Metadata in twts: Key=value is too complicated for non-hackers and hard to write by hand. So if there is a need then we should just use #NSFS or the alt-text file in markdown image syntax ![NSFW](url.to/image.jpg) if something is NSFW

  2. IDs besides datetime. When you edit a twt then you should preserve the datetime if location-based addressing should have any advantages over content-based addressing. If you change the timestamp the its a new post. Just like any other blog cms.

  3. Caching, Yes all good ideas, but that is more a task for the clients not the serving of the twtxt.txt files.

  4. Discovery: User-agent for discovery can become better. I’m working on a wrapper script in PHP, so you don’t need to go to Apaches log-files to see who fetches your feed. But for other Gemini and gopher you need to relay on something else. That could be using my webmentions for twtxt suggestion, or simply defining an email metadata field for letting a person know you follow their feed. Interesting read about why WebMetions might be a bad idea. Twtxt being much simple that a full featured IndieWeb sites, then a lot of the concerns does not apply here. But that’s the issue with any open inbox. This is hard to solve without some form of (centralized or community) spam moderation.

  5. Support more protocols besides http/s. Yes why not, if we can make clients that merge or diffident between the same feed server by multiples URLs

  6. Languages: If the need is big then make a separate feed. I don’t mind seeing stuff in other langues as it is low. You got translating tool if you need to know whats going on. And again when there is a need for easier switching between posting to several feeds, then it’s about building clients with a UI that makes it easy. No something that should takes up space in the format/protocol.

  7. Emojis: I’m not sure what this is about. Do you want to use emojis as avatar in CLI clients or it just about rendering emojis?

⤋ Read More

Two years with my new laptop 💻
It’s now about two years since I got my new laptop and replaced my Surface Go and my desktop computer with it to be more flexible when commuting. Here’s a small recap on why I’m so happy about my companion. ⌘ Read more

⤋ Read More

使用 Go 構建 Web 應用:MVC 模式、Gin 框架、GORM 和 JWT
在本文中,我們將使用 Go 編程語言構建一個 Web 應用程序,利用 Gin 框架進行路由,GORM 進行數據庫交互,並使用 JWT(JSON Web Tokens)進行身份驗證。應用程序將採用 MVC(模型 - 視圖 - 控制器)設計模式,以促進關注點的清晰分離。前置條件—-在開始之前,請確保您具備以下條件:已在您的計算機上安裝 Go(版本 1.16 或更高)。 已設置 Postgre ⌘ Read more

⤋ Read More
In-reply-to » I've been thinking of a few improvements for the next generation of twtxt spec, let me know if these are useful or interesting :) https://text.eapl.mx/a-few-ideas-for-a-next-twtxt-version

Righto, @eapl.me@eapl.me, ta for the writeup. Here we go. :-)

Metadata on individual twts are too much for me. I do like the simplicity of the current spec. But I understand where you’re coming from.

Numbering twts in a feed is basically the attempt of generating message IDs. It’s an interesting idea, but I reckon it is not even needed. I’d simply use location based addressing (feed URL + ‘#’ + timestamp) instead of content addressing. If one really wanted to, one could hash the feed URL and timestamp, but the raw form would actually improve disoverability and would not even require a richer client. But the majority of twtxt users in the last poll wanted to stick with content addressing.

yarnd actually sends If-Modified-Since request headers. Not only can I observe heaps of 304 responses for yarnds in my access log, but in Cache.FetchFeeds(…) we can actually see If-Modified-Since being deployed when the feed has been retrieved with a Last-Modified response header before: https://git.mills.io/yarnsocial/yarn/src/commit/98eee5124ae425deb825fb5f8788a0773ec5bdd0/internal/cache.go#L1278

Turns out etags with If-None-Match are only supported when yarnd serves avatars (https://git.mills.io/yarnsocial/yarn/src/commit/98eee5124ae425deb825fb5f8788a0773ec5bdd0/internal/handlers.go#L158) and media uploads (https://git.mills.io/yarnsocial/yarn/src/commit/98eee5124ae425deb825fb5f8788a0773ec5bdd0/internal/media_handlers.go#L71). However, it ignores possible etags when fetching feeds.

I don’t understand how the discovery URLs should work to replace the User-Agent header in HTTP(S) requests. Do you mind to elaborate?

Different protocols are basically just a client thing.

I reckon it’s best to just avoid mixing several languages in one feed in the first place. Personally, I find it okay to occasionally write messages in other languages, but if that happens on a more regularly basis, I’d definitely create a different feed for other languages.

Isn’t the emoji thing “just” a client feature? So, feed do not even have to state any emojis. As a user I’d configure my client to use a certain symbol for feed ABC. Currently, I can do a similar thing in tt where I assign colors to feeds. On the other hand, what if a user wants to control what symbol should be displayed, similar to the feed’s nick? Hmm. But still, my terminal font doesn’t even render most of emojis. So, Unicode boxes everywhere. This makes me think it should actually be a only client feature.

⤋ Read More

一文帶你看懂 Golang 最新特性
作者:騰訊 PCG 代碼委員會 經過十餘年的迭代,Go 語言逐漸成爲雲計算時代主流的編程語言。下到雲計算基礎設施,上到微服務,越來越多的流行產品使用 Go 語言編寫。可見其影響力已經非常強大。一、Go 語言發展歷史介紹Go 語言起源於 2007 年的 Google;創始人有三位,分別是 Ken Thompson、Rob Pike、Robert Griesemer;他們可謂是大佬中的大佬。最初的構 ⌘ Read more

⤋ Read More

Golang 編譯:靜態鏈接和動態鏈接
本文介紹了 Go 語言中靜態鏈接和動態鏈接的概念,解釋了它們的區別和各自優勢。通過示例,展示瞭如何生成靜態或動態鏈接的二進制文件,以及使用工具進行檢查。文章還討論了內部和外部鏈接器的區別,如何在編譯時選擇鏈接方式,以及在交叉編譯時處理 cgo 的方法。最後,提到了減小二進制文件大小的技巧和安全性方面的考慮。概述–Go 語言最大的優勢之一就是它的編譯器,它爲程序員抽象了許多細節,讓你可以輕鬆地爲幾 ⌘ Read more

⤋ Read More

After testing Vivaldi for a couple of weeks I am convinced this is a great browser and to support the team behind it, I decided to start sending them a couple of Euro monthly, just to keep the momentum going.

⤋ Read More

Go 語言 bufio 包入門:10 分鐘掌握高性能 I-O 操作
大家好,今天我們來聊一個 Go 語言中非常實用的包 - bufio。不管你是剛入門的新手還是有經驗的開發者,這篇文章都能幫你快速掌握 bufio 的使用!🌟 什麼是 bufio?————-bufio 是 Go 語言提供的一個帶緩衝的 I/O 包,它像是給 I/O 操作加了一個 “加速器”,通過減少系統調用次數來提升性能。想象一下:不用緩衝:每次讀寫都直接操作硬盤,就像我們一次只買一 ⌘ Read more

⤋ Read More

Golang 解釋器:Yaegi 內部實現
Yaegi[2]  是一個用 Go 語言編寫的 Go 語言解釋器。這個項目最初是在 Traefik-Labs 啓動的, 目的是爲 traefik 反向代理提供一個簡單實用的嵌入式插件引擎。現在, 社區貢獻的 200 多個插件已經列在  plugins.traefik.io[3]  的公共目錄中。Yaegi 的使用也擴展到其他領域, 例如 數據庫 [4] 、 可觀察性 [5] 、 容器安全 [6] ⌘ Read more

⤋ Read More

完全用 Go 編寫的 JS 引擎
背景介紹隨着互聯網技術的迅猛發展,JavaScript 已經成爲幾乎所有現代網頁和應用開發中不可或缺的組成部分。但是,JavaScript 的執行環境通常侷限於瀏覽器或者 Node.js,這爲那些希望在不同環境下運行 JavaScript 代碼的開發者帶來了限制。特別是在 Go 語言環境中,開發者面臨着將 JavaScript 與 Go 通信的挑戰,因爲二者運行時不一致可能導致性能下降和開發效率降 ⌘ Read more

⤋ Read More

萬字長文講透 Go 程序性能優化
性能分析和優化是所有軟件開發人員必備的技能,也是後臺大佬們口中津津樂道的話題。Golang 作爲一門 “現代化” 的語言,原生就包含了強大的性能分析工具 pprof 和 trace。pprof 工具常用於分析資源的使用情況,可以採集程序運行時的多種不同類型的數據(例如 CPU 佔用、內存消耗和協程數量等),並對數據進行分析聚合生成的報告。trace 工具則關注程序運行時的事件(例如協程狀態切換,G ⌘ Read more

⤋ Read More

Go 中祕而不宣的數據結構 BitVec:位向量 125MB 存儲 10 億個數據
位圖 (bitmap) 是一種優雅而高效的數據結構, 它巧妙地利用了計算機最底層的位運算能力。你可以把它想象成一個巨大的開關陣列, 每個開關只有打開和關閉兩種狀態 —— 這就是位圖的本質。每一位都可以獨立控制, 卻又可以通過位運算實現羣體操作。在實際應用中, 位圖的威力令人驚歎。設想你需要在海量數據中查找重複的數字, 傳統的哈希表或數組都會佔用大量內存。而位圖卻能巧妙地用一個比特位標記一個數字的 ⌘ Read more

⤋ Read More

一個比較 tricky 的 Golang 問題: 最大協程數量
在 Go 語言面試中, 關於 “可以產生的最大協程數量” 這個問題有時會讓候選人措手不及。答案並不是簡單地給出一個具體數字。面試官通常用這個問題來評估你對 Go 併發模型、內存管理以及協程實踐經驗的理解。理解 Go 的併發模型和協程效率首先需要明確以下幾點:協程是由 Go 運行時管理的輕量級用戶空間線程, 比傳統的操作系統線程更高效 Go 並沒有對協程數量設置嚴格限制, 在合適的條件下, 你可以同 ⌘ Read more

⤋ Read More

5 Helpful Uses for Apple Intelligence on Mac, iPhone, & iPad
Apple Intelligence is here on Mac, iPhone, and iPad, and while the system requirements are strict, the Apple devices that are new and powerful enough to use the AI tools now gain some really fantastic features. We’re going to show you six helpful Apple Intelligence features and uses that you’ll find beneficial to your workflow, … [Read More](https://osxdaily.com/2024/11/04/5-helpful-uses-for-apple-intelligence-o … ⌘ Read more

⤋ Read More

10 個最佳 Golang 庫
10 個最佳 Golang 庫—————在 Golang 中,我們可以找到垃圾回收、可接受的庫和標準的類型系統。Golang 適用於系統編程,也被稱爲包。Go 語言被稱爲 Golang 是因爲它在編程語言 GO 中收集了一些可重用的代碼組件。在 Go 語言中,包在組織和結構化代碼方面起着重要作用,還提高了可讀性、代碼可重用性和可維護性。這裏爲你介紹十個最佳 Golang 庫。這 ⌘ Read more

⤋ Read More

一個小例子,給你講透 Go 配置管理,輕鬆將其融入到項目中
在軟件開發中,配置管理是一個不可或缺的部分。無論是開發環境、測試環境還是生產環境,我們都需要一種方法來存儲和讀取配置信息。在 Golang 項目中,Viper 是一個非常流行且功能強大的庫,用於處理配置文件。下面我會寫一些例子,幫助大家快速上手。什麼是 Viper?———-不賣關子,直接上 GitHub 地址:https://github.com/spf13/viper 大家可以直接去 ⌘ Read more

⤋ Read More

Monero Tech meeting scheduled for 18 November 2024 1800 UTC
The next Monero Tech meeting is scheduled to take place on Monday, November 18 2024 at 18:00 UTC, in the #no-wallet-left-behind 1 IRC-Libera/Matrix channels:

Based on the opinions given here2 I decided to go back to the No Wallet Left Behind Matrix room and IRC channel for the next i.e. coming Monday’s meeting, and to not contiune to hold meetings like the last one in the -dev Matrix room and IRC channel.

This meeting’s c … ⌘ Read more

⤋ Read More

(#fmnhewq) Most of the time I think its the Go proxy I run. I wonder whether that thing is just a bit flakey perhaps? 🤔 I dunno, I’d need t …
Most of the time I think its the Go proxy I run. I wonder whether that thing is just a bit flakey perhaps? 🤔 I dunno, I’d need to invest some time standing up some kind of analytics so I can discover the pattern here. ⌘ Read more

⤋ Read More

Kubectl logs tail: a guide to tailing Kubernetes logs
Member post originally published on Middleware’s blog In the world of cloud-native applications, Kubernetes stands as the go-to platform for container orchestration (the automated process of managing, scaling, and maintaining containerized applications across multiple hosts). As applications grow… ⌘ Read more

⤋ Read More

**(#dn2zlga) @Codebuzz Here you go:

$ bat https://twtxt.net/twt/dn2zlga | jq '.'
{
  "twter": {
    "nick": "Codebuzz",
    "uri": "https://w ...**
[@Codebuzz _@www.codebuzz.nl_](https://twtxt.net/external?uri=https://www.codebuzz.nl/twtxt.txt&nick=Codebuzz) Here you go:

$ bat https://twtxt.net/twt/dn2zlga | jq ‘.’
{
“twter”: {

"nick": "Codebuzz",
"uri": "https://www.codebuzz.nl/twtxt.txt",
"avatar": "https://www.codebuzz.nl/twtxt-avatar-800.jpg"

},
“text”: “(#q5rg3ea) Hey, @ I know. Just … ⌘ Read more

⤋ Read More

Golang 隨機公平庫 satmihir-fair
FAIR 是一個 Go 庫, 旨在確保資源受限環境中的公平性。它有助於在資源短缺時將有限的資源 (例如數據庫 / blob 存儲吞吐量、作業執行資源等) 均勻分配給多個客戶端, 防止基於客戶端行爲的過度分配和飢餓。 簡介–FAIR 的核心算法基於 隨機公平 BLUE[1] , 這種算法通常用於網絡擁塞控制, 但做了一些修改。FAIR 的理念是隻在真正資源短缺時進行限制, 而不是像令牌桶或漏桶等 ⌘ Read more

⤋ Read More

構建無密碼認證:passkey 入門與 Go 實現
傳統的密碼認證一直以來都是數字時代的主流身份驗證方式。然而,用戶常常選擇易記的弱密碼並重復使用,導致賬號易受攻擊。密碼泄露、釣魚攻擊等安全問題層出不窮,超過 80% 的數據泄露與密碼相關。與此同時,頻繁的密碼管理和忘記密碼情況嚴重影響用戶體驗。服務商在安全保存用戶密碼方面的責任也增加了系統建設和維護的成本。爲了應對這些問題,科技行業開始積極探索無密碼認證的方法。無密碼認證利用設備生物識別、硬件加密 ⌘ Read more

⤋ Read More

SwarmGo:一個用於構建可擴展 AI Agent 工作流的 Go 模塊化框架
AI 領域正在快速發展,新的應用層出不窮。然而,創建能夠有效協調多個 AI 任務或 Agent(每個 Agent 處理複雜工作流的一部分)的系統仍然具有挑戰性。SwarmGo 應運而生,這是一個功能強大且輕量級的 Go 包,旨在使 AI 應用中的 Agent 編排更易於訪問和擴展。本文將深入探討 SwarmGo 的特性、優勢和結構,並展示如何使用它輕鬆創建智能的模塊化 AI 工作流。什麼是 Swa ⌘ Read more

⤋ Read More

解密 Go runtime-SetFinalizer 的使用
如果我們想在對象 GC 之前釋放一些資源,可以使用 returns.SetFinalizer。這就像在函數返回前執行 defer 來釋放資源一樣。例如:1:使用 runtime.SetFinalizertype MyStruct struct {       Name  string       Other MyStruct   }  func main() {       x := MyStru ⌘ Read more

⤋ Read More

**(#gctrz4q) @falsifian Only that this rendering behavior comes from yarnd’s Markdown parser library that is used:

What has text/markdown go …**
@falsifian @www.falsifian.org Only that this rendering behavior comes from yarnd’s Markdown parser library that is used:

What has text/markdown got to do with this? I don’t think Markdown says anything about replacing ¼ with ¼, or other similar transformations. It’s not needed, because ¼ is already a … ⌘ Read more

⤋ Read More

使用 Go 構建分佈式系統:基於 gRPC 的主從節點架構
在現代軟件開發領域,分佈式系統已經變得至關重要。它們使服務能夠擴展、處理大量數據並提供高可用性。本文將指導您使用 Golang 構建一個簡單的分佈式系統,該系統利用主節點和單個工作節點,並使用 gRPC 協議進行通信。這種架構非常適合數據處理、並行計算和大規模處理工作負載等分佈式任務。我們將介紹如何設置主從結構、建立基於 gRPC 的通信,以及實現簡單的任務分配和執行流程。系統概述—-我們的分 ⌘ Read more

⤋ Read More

Golang 常用的五種創建型設計模式
在 Go 中,創建設計模式有助於管理對象的創建,並控制對象的實例化方式。這些模式在對象創建過程複雜或需要特殊處理時特別有用。以下是 Go 中常用的主要創建模式:單例模式單例模式確保一個類只有一個實例,並提供一個全局訪問點。如何實現定義一個結構,並將其作爲單個實例。 爲該結構創建一個全局變量,但不要立即將其初始化。 使用 sync.Once 確保實例只創建一次,即使在多線程情況下也是如此 ⌘ Read more

⤋ Read More

Neycer Robalino vs Hayden Green – Brisbane Flexi Season (Week 3) Div 1 Final - YouTube This is Neycer one of our coaches at the table-tenn …
Neycer Robalino vs Hayden Green – Brisbane Flexi Season (Week 3) Div 1 Final - YouTube

This is Neycer one of our coaches at the table-tennis club 🏓 that I play at vs. Hayden a top-rated QLD player ( well not anymore 🤣). What a match! 😱 Go #Brisbane [#Table-Tennis](https://twtxt.net/search?q=tags:Table … ⌘ Read more

⤋ Read More

Go 中祕而不宣的數據結構 Treap:平衡樹不一定就用紅黑樹
treap 是一棵二叉樹,它同時維護二叉搜索樹 (BST) 和堆的屬性, 所以由此得名 (tree + heap   ⇒  treap)。從形式上講,treap (tree + heap) 是一棵二叉樹,其節點包含兩個值,一個  key  和一個  priority,這樣 key 保持 BST 屬性,priority 是一個保持 heap 屬性的隨機值(至於是最大堆還是最小堆並不重要)。相對於其 ⌘ Read more

⤋ Read More

Go 語言的組合之道
在軟件開發領域,”組合優於繼承” 的原則常常被奉爲圭臬,因爲它能夠帶來更靈活、更易維護的代碼。Go 語言以其獨特的面對對象設計理念,堅定地選擇了組合而非繼承。本文將深入探討 Go 語言爲何偏愛組合,並闡述其在實際應用中的優勢。繼承的弊端與組合的優勢———–傳統的面對對象編程語言通常依賴繼承機制,允許一個類繼承另一個類的行爲和屬性。然而,這種方式容易導致代碼結構僵化,難以應對需求變化。 ⌘ Read more

⤋ Read More

Monero Tech meeting scheduled for 4 November 2024 1800 UTC
The next Monero Tech meeting is scheduled to take place on Monday, November 4 2024 at 18:00 UTC, in the #no-wallet-left-behind 1 IRC-Libera/Matrix channels:

Based on the opinions given here2 I decided to go back to the No Wallet Left Behind Matrix room and IRC channel for the next i.e. coming Monday’s meeting, and to not contiune to hold meetings like the last one in the -dev Matrix room and IRC channel.

This meeting’s chai … ⌘ Read more

⤋ Read More

**(#rjapt4a) I think it uses the first # url too. See here and here – @xuu@xuu Can you confirm this to be the case? 🙏 GetN("url", ...** I _think_ it uses the first# urltoo. See [here](https://git.mills.io/yarnsocial/go-lextwt/src/branch/main/ast.go#L1062-L1074) and [here](https://git.mills.io/yarnsocial/go-lextwt/src/branch/main/lextwt.go#L88-L95) – [@xuu _@txt.sour.is_](https://twtxt.net/external?uri=https://txt.sour.is/user/xuu/twtxt.txt&nick=xuu) Can you confirm this to be the case? 🙏GetN(“url”, 0)will return the fir ... ⌘ [Read more](https://twtxt.net/twt/5ieybsq)

⤋ Read More

My very strong opinion on the use of Twtxt is if you intend to use it, you should be prepared to let people pull your feed or at least check it …
My very strong opinion on the use of Twtxt is if you intend to use it, you should be prepared to let people pull your feed or at least check it and regular rentals.

Otherwise get out and go use something that’s either a distributed (Mastodon, AT, etc) or centralized (Facebook, X, etc) network. ⌘ Read more

⤋ Read More

After the behaviour of a clearly very angry feed author over the past few days, I’m very tempted to give up on Twtxt and allow it to go back to being dead. What really is the point of building and supporting a way to exchange little pieces of text with one another in a completely decentralized way, if you’re just going to keep bumping up against such hostility? I don’t know why I do this anymore.

⤋ Read More

After the behaviour of a clearly very angry feed author over the past few days, I’m very tempted to give up on Twtxt and allow it to go back to …
After the behaviour of a clearly very angry feed author over the past few days, I’m very tempted to give up on Twtxt and allow it to go back to being dead. What really is the point of building and supporting a way to exchange little pieces of text with one another in a completely decentralised way, if you’re just going to keep humping up against such hostility? I don’t know why I do this any … ⌘ Read more

⤋ Read More

依賴注入:讓 Go 語言更加優雅
依賴注入:讓 Go 語言更加優雅—————-在軟件工程中,依賴注入(Dependency Injection,簡稱 DI)是一種設計模式,它允許我們在不修改類的代碼的情況下向類中注入依賴。這種方式有助於降低代碼間的耦合度,使得各個組件更容易獨立開發和測試。雖然 Go 語言以其簡潔和高效的特性著稱,但在構建大規模應用時,手動管理依賴關係可能會變得複雜和難以維護。這就是 Pa ⌘ Read more

⤋ Read More

從 Go channel 中如何批量讀取數據 ?
在 Go 語言中,我們可以利用 channel 作爲數據的傳輸通道,通過定期批量讀取 channel 中的數據,並將這些數據批量發送到 Kafka 或者進行網絡寫入。這樣可以提高系統的性能,減少單個請求的網絡開銷。批量處理的主要邏輯是:從 channel 中接收數據,積累到一定數量或者達到時間限制後,將數據批量處理(例如發送到 Kafka 或者寫入網絡)。下面我將展示一個從 Go channel ⌘ Read more

⤋ Read More

解析 Golang sync-Once 用法和原理
Once is an object that will perform exactly one action.sync.Once 是 Go 標準庫提供的使函數只執行一次的實現,常應用於單例模式,例如初始化配置、保持數據庫連接等。它可以在代碼的任意位置初始化和調用,因此可以延遲到使用時再執行,併發場景下是線程安全的。對外接口Once 對外僅暴露了唯一的方法 Do(f func()),f 爲需要執行的 ⌘ Read more

⤋ Read More

Go 語言的 RSA 加密與解密:方法與最佳實踐
一般對接過支付業務的都知道,RSA 算法。RSA 是一種廣泛應用於安全通信領域的非對稱加密算法。它使用一對密鑰(公鑰和私鑰)來加密和解密數據,在互聯網通信、數字簽名等場景中具有重要作用。咱們一起看一下,在 Go 語言中,如何使用 RSA 算法。一、RSA 加密與解密的基礎知識1. 非對稱加密RSA 屬於非對稱加密算法,主要特點是密鑰成對使用:一個用於加密(公鑰),另一個用於解密(私鑰)。使用公鑰加 ⌘ Read more

⤋ Read More

Go 邏輯分支優化實戰
TL;DR通過函數式編程和 map 結構可以優化複雜的 if-else 邏輯 提前返回可以避免不必要的資源消耗,防止全表掃描等問題 避免在循環中使用 defer 語句,可能導致資源泄露 使用 for 循環對相同邏輯進行壓縮,提高代碼的簡潔性和可擴展性 代碼的世界,將自然語言的需求轉換成執行的邏輯。如何轉化成代碼之後仍然儘可能接近自然語言的可理解性,是我們一直探求的內容。 ⌘ Read more

⤋ Read More

探索 Go slog 標準庫:設計與應用
本文主要介紹了 Go 語言新引入的 log/slog 標準庫的設計理念、使用方法以及如何進行定製化開發,以提高日誌操作的性能和靈活性。原文: Explore the Go slog Standard Library: Design and Usage[1]在 Go1.21[2] 中引入的 log/slog[3] 軟件包試圖彌補原有日誌軟件包的不足,即日誌缺乏結構化和級別特性。正如提案 [4] ⌘ Read more

⤋ Read More

揭祕 Go sync-Map 設計與實現
什麼是 sync.Map————我們都知道在 Go 語言中,普通的 Map 是非併發安全,併發讀寫時會 panic,sync.Map 則是官方庫提供的一種特殊的併發安全的映射類型,能保較高的性能的同時,還能保證併發安全。sync.Map 有以下幾個特點:sync.Map 特點併發安全: sync.Map 無需額外的鎖機制即可在多個 goroutine 中安全地進行讀寫操作。這對於高 ⌘ Read more

⤋ Read More

Go 項目使用 Makefile 構建版本信息完整教程
目錄結構我們以最小目錄結構爲例進行說明,如下這是我們此次示例的目錄結構。$ tree -L 3.├── main.go├── Makefile├── pkg│   └── version│       └── version.go├── README.md代碼內容主要有兩部分代碼,分別爲 main.go,內容如下:package mainimport (    ”eastMoney/pkg/ver ⌘ Read more

⤋ Read More

Go 語言實現高性能文本壓縮算法 Brotli
在信息爆炸的時代,數據如同洪流般湧現,如何高效地存儲和傳輸這些數據成爲了一項至關重要的技術挑戰。壓縮技術應運而生,它如同一位技藝精湛的魔術師,能夠將龐大的數據文件 “化繁爲簡”,在不損失信息或損失極少信息的情況下將其壓縮成更小的體積,從而節省存儲空間、提高傳輸效率。壓縮技術主要分爲兩大類:無損壓縮和有損壓縮。無損壓縮:顧名思義,這種壓縮方式能夠在解壓縮後完全恢復原始數據,不會造成任何信息損失。常見 ⌘ Read more

⤋ Read More

Apple Seeds watchOS 11.1 Release Candidate
Apple today seeded the release candidate version of an upcoming watchOS 11.1 update to developers and public beta testers for testing purposes. The new software comes approximately week after Apple released the fifth beta.

Image

watchOS 11.1 can be installed by going to the Apple Watch … ⌘ Read more

⤋ Read More

Go 中祕而不宣的數據結構 runq- 難怪運行時調度那麼好
首先,讓我們先來回顧 Go 運行時的 GPM 模型。這方面的介紹網上的資料都非常非常多了,但是我們也不妨回顧一下: GPM 模型中的 G 代表 goroutine。每個 goroutine 只佔用幾 KB 的內存, 可以輕鬆創建成千上萬個。G 包含了 goroutine 的棧、指令指針和其他信息, 如阻塞 channel 的等待隊列等。 P 代表 processor, 可以理解爲一個抽 ⌘ Read more

⤋ Read More

解讀 Golang 標準庫裏的 varint 實現
最近發現 Golang 標準庫竟然自帶了 varint 的實現,代碼位置在 encoding/binary/varint.go。剛好藉助 golang 標準庫的 varint 源碼,我們來系統地學習和梳理下 varint。熟悉 protobuf 的人肯定對 varint 不陌生,protobuf 裏面除了帶 fix (如 fixed32、fixed64) 之外的整數類型, 都是 varint 編碼 ⌘ Read more

⤋ Read More

Monero Tech meeting scheduled for 28 October 2024 1800 UTC
The next Monero Tech meeting is scheduled to take place on Monday, October 28 2024 at 18:00 UTC, in the #no-wallet-left-behind 1 IRC-Libera/Matrix channels:

Based on the opinions given here2 I decided to go back to the No Wallet Left Behind Matrix room and IRC channel for the next i.e. coming Monday’s meeting, and to not contiune to hold meetings like the last one in the -dev Matrix room and IRC channel.

This meeting’s chai … ⌘ Read more

⤋ Read More

How to Re-Enable Slow Motion Effects on MacOS
If you’re a long time Mac user, you might recall the Slow Motion effect that could be applied by holding the Shift key while minimizing and maximizing windows, as well as for other animations like opening Launchpad or using Mission Control. Some of the fun eye-candy effects on Mac go way the early days of … Read MoreRead more

⤋ Read More

Go 信號處理:優雅地關閉你的應用
在構建健壯且可靠的應用程序時,優雅地處理系統信號至關重要。系統信號,如 SIGINT(中斷信號,通常由 Ctrl+C 觸發)和 SIGTERM(終止信號),允許我們以可控的方式關閉應用程序,執行必要的清理操作,例如關閉連接、釋放資源和保存狀態。本文將深入探討在 Go 語言中如何處理系統信號。我們將涵蓋以下主題:理解系統信號 使用 os/signal 包捕獲信號 實現優雅的關閉機制 ⌘ Read more

⤋ Read More

Go 每日一題:併發下載與合併
答案–實現思路:文件分割: 將目標文件分割成多個大小相等的塊(例如 10MB / 塊)。 併發下載: 爲每個文件塊創建一個 goroutine,每個 goroutine 負責下載對應塊的內容並保存到臨時文件中。 同步與合併: 使用 channel 來同步所有 goroutine 的下載進度,並在所有塊下載完成後,按順序合併所有臨時文件,最終得到完整的原始文件。 代碼示例:pac ⌘ Read more

⤋ Read More

一文掌握 Go 語言 I-O 操作中的 io-Reader 和 io-Writer
在 Go 語言中,io.Reader 和 io.Writer 是兩個至關重要的接口,它們爲處理輸入輸出操作提供了強大且靈活的抽象。本文將深入探討這兩個接口的機制、常見用例、潛在陷阱以及一些高級應用,幫助你更好地掌握 Go 語言的 I/O 操作。io.Reader 接口:數據讀取的基礎———————-io.Reader 接口定義了讀取數據的通用方法:type Reader ⌘ Read more

⤋ Read More

** Sleepy garden beds **
This afternoon I put the garden to sleep for the fall; in the past we’ve had some fall and winter vegetables going, but this year that didn’t happen, so, I emptied out the rain barrels, cleaned them out, trundled them to a place where they wouldn’t get blown around by any winds, mulched some of the beds, weeded and generally plotzed around like a garden goblin.

I’ve fallen into the habit of making a big thing of rice over the weekend — I always intend to do something with this rice, but instead I use it for s … ⌘ Read more

⤋ Read More

Go 中祕而不宣的數據結構 spmc- 10 倍性能於 channel
Go 標準庫和運行中中,有一些專門針對特定場景優化的數據結構,這些數據結構並沒有暴露出來,這個系列就是逐一介紹這些數據結構。這一次給大家介紹的就是一個 lock-free、高性能的單生產者多消費者的隊列:PoolDequeue 和 PoolChain。 到底是一個還是兩個呢? 主要是 PoolDequeue, 它是一個固定尺寸,使用 ringbuffer (環形隊列) 方式實現的隊列。PoolCh ⌘ Read more

⤋ Read More

Sam Whited: Coffeeneuring 2024
Every year in October I participate in Love To Ride’s (psst, sign up using
that link so I can get some extra points when you do your first bike ride!)
Biketober competition.
The TL;DR is that for every day that you go for a ride, for every mile that you
ride, and for every new rider that you invite you get points for your team.
At the end of the month winners are announced and there are some fun prizes.
It’s not about bi … ⌘ Read more

⤋ Read More

深入理解 Go 語言的棧
本期深入研究 Go 堆棧的工作原理以及作爲程序員爲什麼要關心它。本篇內容是根據 2023 年 3 月份#288 A deep dive into Go’s stack[1] 音頻錄製內容的整理與翻譯過程中爲符合中文慣用表達有適當刪改, 版權歸原作者所有. Mat Ryer: 大家好,歡迎收聽 Go Time。我是 Mat Ryer[2]。今天我們要討論的是 Go 的棧。究竟什麼是棧?它的作用 ⌘ Read more

⤋ Read More

溫故知新——Golang GMP 萬字洗髓經
0 前言—-我在 23 年初曾發佈過一篇——golang gmp 原理解析,當時剛開始接觸 go 底層源碼,視野廣度和理解深度都有所不足,對一些核心環節的思考和挖掘有所欠缺,對其中某些局部細節又過分拘泥,整體內容質量上還是有所不足.隨着近期嘗試接觸了 golang 以外的語言,通過橫向對比後,對於 golang 中 gmp 的精妙設計也產生了一些新的感悟. 於是就藉着這個契機開啓一個重置篇,對 ⌘ Read more

⤋ Read More

Monero Tech meeting scheduled for 21 October 2024 1800 UTC
The next Monero Tech meeting is scheduled to take place on Monday, October 21 2024 at 18:00 UTC, in the #no-wallet-left-behind 1 IRC-Libera/Matrix channels:

Based on the opinions given here2 I decided to go back to the No Wallet Left Behind Matrix room and IRC channel for the next i.e. coming Monday’s meeting, and to not contiune to hold meetings like the last one in the -dev Matrix room and IRC channel.

This meeting’s chai … ⌘ Read more

⤋ Read More

深入理解 go unsafe
Go 是支持指針的語言,但是爲了保持簡潔、安全,Go 的指針有很多限制,但是一些場景又需要繞過這些安全限制,因此提供了 unsafe 包,unsafe 可以繞過:指針運算、不同的指針類型不能轉換、任意類型指針等限制,進而可以實現更高級的功能。下面通過對比可以更直觀的瞭解 unsafe 的特點:支持指針運算——Go 的指針是不支持指針運算的,指針運算在直接操作內存有很大作用,例如:通過指針運 ⌘ Read more

⤋ Read More

揭祕 Go 併發利器 WaitGroup
在 Go 語言的併發編程世界中,WaitGroup 是一個至關重要的工具,它爲開發者提供了一種簡單而有效的方式來管理和同步多個協程的執行。本文將深入揭祕 WaitGroup 的實現原理、注意事項、使用示例。什麼是 WaitGroup————-WaitGroup 是 Go 標準庫中 sync 包提供的一種同步原語,用於等待一組(可能是併發的)操作完成。它的主要作用是讓主協程(即調用 ⌘ Read more

⤋ Read More

7 個實用技巧幫助你更好地玩轉 Go Structs
在本文中,我們將探討使用結構體的 7 個技巧,掌握它們能夠幫助開發者寫出更高效、更可維護的 Go 代碼。Go 中的結構體是一種複合數據類型,它將變量集中在一個名稱下。它們是許多 Go 程序的支柱,是創建複雜數據結構和實現面向對象設計模式的基礎。但結構體的功能遠不止簡單的數據分組。1. EmbeddingEmbedding 是 Go 的一項強大功能,它允許將一個結構包含在另一個結構中,提供了一種合成 ⌘ Read more

⤋ Read More

golang 是如何防範 SQL 注入、CSRF、XSS 攻擊 的
在 Go 語言的 Web 開發中,常見的安全問題包括 SQL 注入、CSRF(跨站請求僞造)、和 XSS(跨站腳本攻擊)。Go 提供了多種機制與工具庫來防範這些攻擊。以下是針對每種攻擊的防範措施:防範 SQL 注入————SQL 注入 是一種通過修改 SQL 查詢的輸入,使攻擊者能夠執行未授權 SQL 語句的攻擊手段。防範 SQL 注入的關鍵是避免直接拼接 SQL 字符串,而是使用 ⌘ Read more

⤋ Read More
In-reply-to » @prologic would you please check my web interface? is that a normal thing or am I missing something?

Web interface is deleted in https://git.mills.io/saltyim/saltyim/commit/376de2702319686c902ec03b8ca1e17b020fc639 but seems incorrectly (in source i see git lfs metadata). Can be builded if you grab https://git.mills.io/saltyim/saltyim/src/commit/15a64de82829/internal/web/app.wasm and place it in source (go directory has cached source) and rebuild

⤋ Read More