Searching We.Love.Privacy.Club

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

@movq@www.uninformativ.de going a little sideways on this, “*If twtxt/Yarn was to grow bigger, then this would become a concern again. But even Mastodon allows editing, so how much of a problem can it really be? 😅*”, wouldn’t it preparing for a potential (even if very, very, veeeeery remote) growth be a good thing? Mastodon signs all messages, keeps a history of edits, and it doesn’t break threads. It isn’t a problem there.😉 It is here.

I think keeping hashes is a must. If anything for that “feels good” feeling.

⤋ Read More

Go 開發人員開發 WebRTC 的福音
Pion 是 WebRTC API 的純 Golang 實現。開發 WebRTC 應用可以使用該庫,提高開發效率。你可以使用 Pion 去創造一些很棒的東西,以下是一些可以讓你創意源源不斷的想法:發送一個視頻文件到多個瀏覽器,以實現完美同步的電影觀看。 將嵌入式設備上的網絡攝像頭內容發送到瀏覽器,無需額外的服務器。 不需要訂閱發佈,就可以在兩臺服務器之間安全地發送數據。 ⌘ Read more

⤋ Read More

GVM: Golang 多版本管理利器
本文介紹了 Go Version Manager 的功能和使用方法,介紹瞭如何通過 GVM 在系統上安裝和管理多個 Go 語言版本。原文: GVM: Go Version Manager, for Golang manage multiple versions[1]Go 版本管理器(GVM,Go Version Manager)是一款功能強大的工具,旨在簡化系統中 Go 編程語言不同版本的管理 ⌘ Read more

⤋ Read More

Go 語言 API 文檔利器:絲襪哥(Swagger)保姆級使用指南大揭祕!
咱們都知道在 API 開發中,文檔是必不可少的一環。swaggo/swag 是一個用於 Go 語言的自動化生成 API 文檔的工具,它可以將代碼註釋轉換爲 Swagger 文檔,方便開發者和用戶理解 API 的使用方法。本文將詳細介紹 swaggo/swag 的使用方式以及它的特性。1. 安裝 Swaggo/Swag先在你的 Go 項目中安裝 swag 命令行工具和 gin-swagger 依賴: ⌘ Read more

⤋ Read More

構建由大型語言模型(LLM)驅動的 Go 應用程序
隨着過去一年大型語言模型(LLM)及其相關工具(如嵌入模型)的能力顯著增長,越來越多的開發者開始考慮將 LLM 集成到他們的應用程序中。由 於 LLM 通常需要專用硬件和大量的計算資源,它們最常見的形式是作爲提供 API 訪問的網絡服務。這就是領先的 LLM 如 OpenAI 或 Google Gemini 的 API 的工作方式;即使是運行你自己的 LLM 工具,如 Ollama[1],也會將 ⌘ Read more

⤋ Read More

Go 語言實現 systemctl 管理系統服務
在 Linux 系統中,systemd 已然成爲主流的初始化系統和服務管理器,而 systemctl 命令則是我們與之交互的橋樑。對於 Go 開發者而言,直接使用 Shell 調用 systemctl 固然可行,但難免顯得不夠優雅,並且需要編寫額外的代碼來解析命令輸出。爲解決這一問題,taigrr/systemctl 庫應運而生。它爲 Go 開發者提供了符合習慣用法的 systemctl  綁定, ⌘ Read more

⤋ Read More

Go 構建一個簡單的負載均衡器
Go–負載均衡器在現代軟件開發中至關重要。作爲開發者你肯定好奇過請求是如何在多個服務器之間分配的,或者爲什麼某些網站即使在高流量時也感覺更快,這就是負載均衡器的作用。沒有負載均衡器在這篇文章中,我們將使用 Go 語言構建一個簡單的應用程序負載均衡器,使用輪詢算法(Round Robin)。這篇文章的目的是一步步理解負載均衡器的內部工作原理。什麼是負載均衡器?負載均衡器是一個系統,它將傳入的網絡流 ⌘ Read more

⤋ Read More
In-reply-to » (#o) @prologic this was your first twtxt. Cool! :-P

@movq@www.uninformativ.de I figured it will be something like this, yet, you were able to reply just fine, and I wasn’t. Looking at your twtxt.txt I see this line:

2024-09-16T17:37:14+00:00	(#o6dsrga) @<prologic https://twtxt.net/user/prologic/twtxt.txt>

@<quark https://ferengi.one/twtxt.txt> This is what I get. 🤔

Which is using the right hash. Mine, on the other hand, when I replied to the original, old style message (Message-Id: <o6dsrga>), looks like this:

2024-09-16T16:42:27+00:00	(#o) @<prologic https://twtxt.net/user/prologic/twtxt.txt> this was your first twtxt. Cool! :-P

What did you do to make yours work? I simply went to the oldest @prologic@twtxt.net’s entry on my Maildir, and replied to it (jenny set the reply-to hash to #o, even though the Message-Id is o6dsrga). Since jenny can’t fetch archived twtxts, how could I go to re-fetch everything? And, most importantly, would re-fetching fix the Message-Id:?

⤋ Read More

使用 Go 語言生成樣式美觀的 PDF 文件
在當今數字化時代,PDF 已成爲一種不可或缺的文檔格式,它能夠在各種平臺上保持一致的顯示效果。然而,使用傳統的編程語言生成 PDF 文件往往是一項繁瑣而複雜的任務。Maroto 的出現爲 Go 語言開發者帶來了福音,它提供了一種簡潔優雅的方式來創建結構清晰、樣式美觀的 PDF 文檔。Maroto 簡介———Maroto 是一個基於 Go 語言的 PDF 生成庫,其靈感來源於 Boots ⌘ Read more

⤋ Read More

探索 Goja: 一個 Golang JavaScript 運行時
本文探討了 Golang 生態系統中的 JavaScript 運行時庫  Goja[1] 。Goja 作爲一個在 Go 應用程序中嵌入 JavaScript 的強大工具脫穎而出, 在操作數據和提供無需 go build 步驟的 SDK 方面具有獨特優勢。背景: 爲什麼需要 Goja在我的項目中, 在查詢和操作大型數據集時遇到了挑戰。最初, 所有內容都是用 Go 編寫的, 這很高效, 但在處理複雜的 ⌘ Read more

⤋ Read More

開源免費定時任務管理系統 Gocron
概覽–Gocron 是一個開源免費的定時任務管理系統。它使用 Go 語言開發,是一個輕量級定時任務集中調度和管理系統,用於替代 Linux-crontab,旨在爲開發者及運維人員提供一個高效、輕量級且用戶友好的任務調度解決方案。作爲 Linux-crontab 的現代化替代品,Gocron 不僅繼承了傳統定時任務管理的靈活性,還融入了強大的 Web 界面管理功能,使得任務配置、監控與維護變得前所 ⌘ Read more

⤋ Read More

Go1-23 新特性:再開後門,可以記錄未捕獲的 panic 和 throw 日誌了!
大家好,我是煎魚。今天繼續給大家分享 Go1.23 的新特性,這一輪裏還是有不小有意思的驚喜的。其中不得不評本文中的這個新變化。必須得來一篇獨立話題來提一下這個事!過去學習寫 Go 時,初學者入門的教程教一定會提到在使用 panic 時,強烈建議要使用 recover。否則在 goroutine 的場景下很容易出問題,也會導致記不來日誌。新版本後,終於有兜底 Go 程序崩潰的日誌記錄方法了!過於感 ⌘ Read more

⤋ Read More

Things to do in Salt Lake City
With KubeCon + CloudNativeCon North America 2024 just a few months away we thought it would be fun to ask our ambassadors and other locals about where to go and what to do while we’re all in Salt… ⌘ Read more

⤋ Read More

函數類型的 Range - Go 編程語言
簡介 —–這是我在 2024 年 GopherCon 大會上演講的博客文章版本。函數類型的 range 是 Go 1.23 版本中的一個新語言特性。這篇博文將解釋爲什麼我們要添加這個新特性, 它究竟是什麼, 以及如何使用它。爲什麼?—-自 Go 1.18 以來, 我們已經能夠在 Go 中編寫新的泛型容器類型。例如, 讓我們考慮這個非常簡單的Set類型, 一個基於 map 實現的泛型類型 ⌘ Read more

⤋ Read More

So this is a great thread. I have been thinking about this too.. and what if we are coming at it from the wrong direction? Identity being tied to a given URL has always been a pain point. If i get a new URL its almost as if i have a new identity because not only am I serving at a new location but all my previous communications are broken because the hashes are all wrong.

What if instead we used this idea of signatures to thread the URLs together into one identity? We keep the URL to Hash in place. Changing that now is basically a no go. But we can create a signature chain that can link identities together. So if i move to a new URL i update the chain hosted by my primary identity to include the new URL. If i have an archived feed that the old URL is now dead, we can point to where it is now hosted and use the current convention of hashing based on the first url:

The signature chain can also be used to rotate to new keys over time. Just sign in a new key or revoke an old one. The prior signatures remain valid within the scope of time the signatures were made and the keys were active.

The signature file can be hosted anywhere as long as it can be fetched by a reasonable protocol. So say we could use a webfinger that directs to the signature file? you have an identity like frank@beans.co that will discover a feed at some URL and a signature chain at another URL. Maybe even include the most recent signing key?

From there the client can auto discover old feeds to link them together into one complete timeline. And the signatures can validate that its all correct.

I like the idea of maybe putting the chain in the feed preamble and keeping the single self contained file.. but wonder if that would cause lots of clutter? The signature chain would be something like a log with what is changing (new key, revoke, add url) and a signature of the change + the previous signature.

# chain: ADDKEY kex14zwrx68cfkg28kjdstvcw4pslazwtgyeueqlg6z7y3f85h29crjsgfmu0w 
# sig: BEGIN SALTPACK SIGNED MESSAGE. ... 
# chain: ADDURL https://txt.sour.is/user/xuu
# sig: BEGIN SALTPACK SIGNED MESSAGE. ...
# chain: REVKEY kex14zwrx68cfkg28kjdstvcw4pslazwtgyeueqlg6z7y3f85h29crjsgfmu0w
# sig: ...

⤋ Read More

Where the Eder flows into the Fulda
Just in time before it gets cold and rainy again next week, I took advantage of today to go for a short bike ride. Upstream along the Fulda, over to the Eder and then to where the Eder flows into the Fulda. This was the short (49 km) of the two versions I had planned for this. The longer version is almost 90 kilometers long. Let’s see if I can still do it this year… ⌘ Read more

⤋ Read More

@prologic@twtxt.net Some criticisms and a possible alternative direction:

  1. Key rotation. I’m not a security person, but my understanding is that it’s good to be able to give keys an expiry date and replace them with new ones periodically.

  2. It makes maintaining a feed more complicated. Now instead of just needing to put a file on a web server (and scan the logs for user agents) I also need to do this. What brought me to twtxt was its radical simplicity.

Instead, maybe we should think about a way to allow old urls to be rotated out? Like, my metadata could somehow say that X used to be my primary URL, but going forward from date D onward my primary url is Y. (Or, if you really want to use public key cryptography, maybe something similar could be used for key rotation there.)

It’s nice that your scheme would add a way to verify the twts you download, but https is supposed to do that anyway. If you don’t trust https to do that (maybe you don’t like relying on root CAs?) then maybe your preferred solution should be reflected by your primary feed url. E.g. if you prefer the security offered by IPFS, then maybe an IPNS url would do the trick. The fact that feed locations are URLs gives some flexibility. (But then rotation is still an issue, if I understand ipns right.)

⤋ Read More

如何實現限制用戶 1 分鐘內最多請求 1000 次?
在高併發場景下,如何保護你的服務不被海量請求壓垮?限流器是你的不二之選。本文將帶你使用 Go 語言,實現一個高效的限流器,限制每分鐘內用戶的最大請求次數。限流算法的選擇——-常見的限流算法有很多,例如:計數器算法: 設定一個時間窗口,在窗口內對請求進行計數,超過閾值則拒絕請求。 漏桶算法: 將請求想象成水滴,漏桶以固定速率漏水,溢出則拒絕請求。 令牌桶算法: 以固定速率生成令牌 ⌘ Read more

⤋ Read More

@lyse@lyse.isobeef.org 31°C here, feels like 33°C, with a lovely 75% of humidity. It has been raining, on and off (to make matter “better”) the whole day until now. No horses here, but if you go outside you will smell the same smell of farm animals (like goats, or pigs). That’s because two or three kilometres from here there are private farms, and when the wind blows in such way, well, we are reminded of their existence.

I haven’t left the house, so it feels well under air conditioning. In two more hours I will call it quits from the work day, and will have to dash to the grocery to get supplies for tonight’s meal (arroz con gandules). I will let you know how it truly feels out there then. :-D

For those swollen fingers, nothing better than a mildly cold shower! Oh, and paws off the keyboard! :-P

⤋ Read More

橋接 Rust 和原生 Go
你好,大家好,我是 yuchanns!最近我做了一些有趣的事情,想和你分享:介紹 OpenDAL 作爲 Go 語言的原生綁定。 TLDR;  我將向你展示一種可行的方法,利用 purego 和 libffi 的魔力,從 Rust 和 C 組件構建原生 Go 綁定。什麼是 OpenDAL?————Apache OpenDAL[1] 是一個 Rust 庫,提供了統一的數據訪問層。它爲 ⌘ Read more

⤋ Read More

Golang - 使用 GoFakeIt 生成 Mock 數據
介紹–在軟件開發中,測試至關重要,以確保代碼能夠按預期工作。然而出於隱私考慮、數據可用性以及收集和清理數據,使用真實數據進行測試是不合理的。我們需要生成 Mock 數據來進行測試。在 Go 編程語言中,用於生成假數據的最流行庫之一是 GoFakeIt[1]。什麼是 GoFakeIt?————-GoFakeIt 是一個強大的庫,允許開發人員爲測試目的生成各種隨機數據。它支持創建名字 ⌘ Read more

⤋ Read More

用 Go 語言構建輕量級 ChatGPT 網頁版
近年來,大型語言模型(LLM)的快速發展徹底改變了人機交互的方式。ChatGPT 作爲其中的佼佼者,憑藉其強大的自然語言處理能力,在各個領域都展現出巨大的應用潛力。然而,對於開發者而言,構建自己的 ChatGPT 應用往往需要耗費大量的時間和資源。Ollama 和 Ollamaweb 的出現爲開發者提供了一個快速構建類 ChatGPT 應用的解決方案。Ollama 是一款開源的 LLM 服務,它支 ⌘ Read more

⤋ Read More

Go 機器學習框架之火重燃,Google 前研究員開源期望媲美 Jax 的 GoMLX
Go 作爲一門兼具高性能與簡潔性的編程語言,近年來在各種領域得到廣泛應用。然而,在機器學習領域,Go 相比 Python、C++、Julia 等語言,生態仍然較爲薄弱。目前的 Go 機器學習框架無論在功能全面性上,還是在社區生態支持上都難以與 TensorFlow、PyTorch、Jax 等重量級框架抗衡。究其原因,筆者覺得還是 Go 社區缺少熟悉和精通機器學習方面的人才。不過,隨着時間的推移,總 ⌘ Read more

⤋ Read More

Go 語言實現 Windows 守護進程
在 Windows 系統中,守護進程(Windows Service)扮演着不可或缺的角色,默默地執行着後臺任務,保障着系統的穩定運行。本文將深入探討如何利用 Go 語言簡潔高效地構建 Windows 守護進程,並輔以詳細的代碼示例,助你輕鬆掌握這一實用技能。Windows 守護進程:幕後的無名英雄——————–不同於我們日常使用的應用程序,Windows 守護進程沒有華 ⌘ Read more

⤋ Read More

Go 熱重載:使用 Air 改變你的開發流程
在 Go 語言開發中,每次修改代碼後都需要手動重啓服務,這無疑是一件效率低下的事情。本文將介紹一款名爲 Air 的工具,它可以幫助我們實現 Go 代碼的熱重載,從而極大地提升開發效率。手動重啓的煩惱——-假設我們有一個運行中的 Go 程序,例如:go run main.go該程序可能使用 fsnotify 來監聽配置文件的變化,例如 config.json:{  ”dbhost”: ”lo ⌘ Read more

⤋ Read More

Go 語言函數的幕後:從符號表到棧幀
Go 函數是構建 Go 程序的基本模塊,我們每天都在使用它們,但你是否想過 Go 函數在編譯和運行時是如何工作的呢?本文將深入探討 Go 函數的內部機制,從符號表到棧幀,揭示 Go 函數運行的奧祕。函數的命名和符號表———在 Go 中,每個函數都有一個唯一的名稱,這是因爲 Go 編譯器會創建一個符號表來記錄所有變量和函數的名稱。當我們在代碼中定義一個函數時,它的名稱會被添加到符號表中。 ⌘ Read more

⤋ Read More

如何在 Go 中構建可插拔的庫
什麼是 go buildmode=plugin?————————go buildmode=plugin 選項允許開發者將 Go 代碼編譯成共享對象文件。另一個 Go 程序可以在運行時加載該文件。當我們想在應用程序中添加新功能而又不想重建它時,這個選項非常有用。可以將新功能作爲插件加載。Go 中的插件是編譯成共享對象(.so)文件的軟件包。可以使用 Go 中的 plu ⌘ Read more

⤋ Read More

Go 協程上下文切換的代價
在高併發場景下,Go 語言的協程 (Goroutine) 以其輕量級、高效的特性而聞名。但協程的上下文切換真的像想象中那樣輕量級嗎?它在性能上究竟有多大的優勢?本文將深入探討 Go 協程的上下文切換機制,分析其效率和潛在的代價。協程上下文切換的效率———-與傳統的線程相比,Go 協程的上下文切換髮生在用戶空間,避免了昂貴的系統調用,因此切換速度更快。實驗表明,Go 協程的上下文切換平均 ⌘ Read more

⤋ Read More

Builder 模式在 Go 語言中的應用
Builder 模式是一種創建型模式,即用來創建對象。Builder 模式,中文翻譯不太統一,有時候被翻譯爲建造者模式或構建者模式,有時候也被翻譯爲生成器模式。爲了不給讀者造成困擾,我還是直接叫它 Builder 模式好了。《設計模式:可複用面向對象軟件的基礎》 一書中對 Builder 模式的意圖闡明如下: 將一個複雜對象的構建與它的表示分離,使得同樣的構建過程可以創建不同的表示。經典 Bui ⌘ Read more

⤋ Read More
In-reply-to » @movq, maybe you can help me with this. I want to place the vim cursor at the end of the first line on replies, and forks. I have tried adding to this to jenny's configuration:

@movq@www.uninformativ.de hmm, I am already using au BufNewFile,BufRead jenny-posting.eml setl completefunc=jenny#CompleteMentions fo-=t wrap, from jenny. How would I go to incorporate that there?

⤋ Read More
In-reply-to » @movq, maybe you can help me with this. I want to place the vim cursor at the end of the first line on replies, and forks. I have tried adding to this to jenny's configuration:

@movq@www.uninformativ.de hmm, I guess I could do that too. I have startinsert set on my .vimrc, so I will either have to take it out, or exit insert, $, then insert again. I think the way you do it would be the way to go.

I tried setting VISUAL to be something like vim -c 'star!', which does the same thing, but no dice. :-/

⤋ Read More

@bender@twtxt.net and I saw some conspiracy theory that he knew he was going to be arrested. He was working with French intelligence on a plea deal to defect. And now Russia is freaking out that Ukraine allies can have war comms access.

Yikes! If only they had salty.im!

⤋ Read More

There is a bug in yarnd that’s been around for awhile and is still present in the current version I’m running that lets a person hit a constructed URL like

YOUR_POD/external?nick=lovetocode999&uri=https://socialmphl.com/story19510368/doujin

and see a legitimate-looking page on YOUR_POD, with an HTTP code 200 (success). From that fake page you can even follow an external feed. Try it yourself, replacing “YOUR_POD” with the URL of any yarnd pod you know. Try following the feed.

I think URLs like this should return errors. They should not render HTML, nor produce legitimate-looking pages. This mechanism is ripe for DDoS attacks. My pod gets roughly 70,000 hits per day to URLs like this. Many are porn or other types of content I do not want. At this point, if it’s not fixed soon I am going to have to shut down my pod. @prologic@twtxt.net please have a look.

⤋ Read More

Go 程序如何實現優雅退出?來看看 K8s 是怎麼做的——下篇
K8s 的優雅退出現在,我們已經掌握了 Go 中 HTTP Server 程序如何實現優雅退出,是時候看一看 K8s 中提供的一種更爲優雅的優雅退出退出方案了😄。這要從 K8s API Server 啓動入口說起: https://github.com/kubernetes/kubernetes/blob/release-1.31/cmd/kube-apiserver/apiserver.gofRead more

⤋ Read More

Go 程序如何實現優雅退出?來看看 K8s 是怎麼做的——上篇
在寫 Go 程序時,優雅退出是一個老生常談的問題,也是我們在微服務開發過程中的標配,本文就來介紹下工作中常見的幾種優雅退出場景,以及帶大家一起來看一下 K8s 中的優雅退出是怎麼實現的。優雅退出我們一般可以通過如下方式執行一個 Go 程序:$ go build -o main main.go$ ./main如果要停止正在運行的程序,通常可以這樣做:在正在運行程序的終端執行 Ctrl + C。 ⌘ Read more

⤋ Read More

golang 日誌打印 如何添加 goroutinei
在 Go 語言中,標準庫沒有直接提供獲取 goroutine ID 的功能,因此,如果我們想在日誌中添加 goroutine ID,需要藉助一些非標準的方式來實現。方法 1: 通過第三方庫(如 github.com/petermattis/goid)github.com/petermattis/goid 是一個常用的第三方庫,它可以幫助我們獲取當前 goroutine 的 ID。我們可以通過它來實 ⌘ Read more

⤋ Read More