Searching txt.sour.is

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

** 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

Go 語言中的 os-Stat– 與 os-Lstat–
文件操作是系統編程中至關重要的一部分,而 Go 語言提供了通過其 os 包訪問文件元數據的直觀方法。兩個常用的函數,os.Stat() 和 os.Lstat(),允許您收集有關文件和符號鏈接的信息,但它們的作用不同。本文將解釋這兩個函數之間的關鍵區別,說明它們的實際應用,並深入探討一些高級注意事項,例如錯誤處理和性能。Go 中的文件信息———Go 語言中的 os.FileInfo 接口 ⌘ Read more

⤋ Read More

Apple Card High-Yield Savings Account Getting Yet Another Interest Rate Cut
Apple is once again planning to cut the interest rate of its Apple Card high-yield savings account, with the new rate set to go live on Friday, October 11.

Image

The ‌Apple Card‌ savings account’s annual percentage yield (APR) will drop to 4.10 percent, down from 4.25 percent. This is the … ⌘ Read more

⤋ Read More

在兩個大文件中找出相同的記錄,用 golang 如何寫?
在 Go 語言中找出兩個大文件中相同的記錄,可以採用以下策略:思路讀文件:按行逐行讀取兩個文件中的記錄,假設每個文件的每一行代表一條記錄。 使用哈希集合(Set):因爲哈希集合能夠快速判斷某個記錄是否存在,所以我們可以將第一個文件中的記錄放入集合中,之後讀取第二個文件時逐行判斷該記錄是否也存在於集合中。如果存在則是相同的記錄。 性能優化: 如果文件非常大,避免一次性全部加載到內存 ⌘ Read more

⤋ Read More
In-reply-to » @doesnm Agree. salty.im should allow the user to post multiple brokers on their webfinger so the client can find a working path.

Honestly… not much. Have abandon two projects (both private) on Golang and one related to cryptography. My mostly languages are Python and Javascript (also can PHP). After writing code on Go i spend same time on fixing dumb errors

⤋ Read More

什麼是 WebSocket?Go_WebSocket 編程來了!
爲什麼要有 WebSocket?—————-已經有了 HTTP 了爲什麼還要有 WebSocket 呢?因爲,HTTP 的請求只能由客戶端發起,服務器接收。但是,現在想要讓服務器端也可以主動發起請求。那麼使用 HTTP 是無法滿足的。其次,還有一種就是,如果想要監聽服務端發送的請求。那麼,可以讓客戶端始終處於一種輪詢狀態。客戶端每隔一段就發起一個詢問,看一下服務端有沒有請求信息 ⌘ Read more

⤋ Read More

MacBook Pro With M4 Chip May Support Up to Two External Displays
Apple’s upcoming entry-level M4 14-inch MacBook Pro may be capable of supporting up to two external displays, up from one display supported in the current M3 model, if recent leaks are anything to go by.

Image

Apple’s existing M3 14-inch MacBook Pro comes with two Thunderbolt 3 USB-C ports, not three Thunderbolt 4 … ⌘ Read more

⤋ Read More

Monero Tech meeting scheduled for 14 October 2024 1800 UTC
The next Monero Tech meeting is scheduled to take place on Monday, October 14 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

Spotify Launches Offline Backup Feature for Premium Users
Spotify has announced a new feature called Offline Backup, designed to give Premium subscribers an additional way to listen to music offline without manually downloading playlists. Rolling out globally this week, the feature aims to address situations where users find themselves without an internet connection and haven’t … ⌘ Read more

⤋ Read More
In-reply-to » @prologic I wanted to wait for things to settle down. It’s still unclear to me in which direction we’re going – and if that new/different stuff is even possible to implement in jenny. That said, I’ve been really busy with private stuff these last few days, I’ve lost track of most of what you’re discussing. 🥴

I share I did write up an algorithm for it at some point I think it is lost in a git comment someplace. I’ll put together a pseudo/go code this week.

Super simple:

Making a reply:

  1. If yarn has one use that. (Maybe do collision check?)
  2. Make hash of twt raw no truncation.
  3. Check local cache for shortest without collision
    • in SQL: select len(subject) where head_full_hash like subject || '%'

Threading:

  1. Get full hash of head twt
  2. Search for twts
    • in SQL: head_full_hash like subject || '%' and created_on > head_timestamp

The assumption being replies will be for the most recent head. If replying to an older one it will use a longer hash.

⤋ Read More
In-reply-to » @prologic I wanted to wait for things to settle down. It’s still unclear to me in which direction we’re going – and if that new/different stuff is even possible to implement in jenny. That said, I’ve been really busy with private stuff these last few days, I’ve lost track of most of what you’re discussing. 🥴

I share I did write up an algorithm for it at some point I think it is lost in a git comment someplace. I’ll put together a pseudo/go code this week.

Super simple:

Making a reply:

  1. If yarn has one use that. (Maybe do collision check?)
  2. Make hash of twt raw no truncation.
  3. Check local cache for shortest without collision
    • in SQL: select len(subject) where head_full_hash like subject || '%'

Threading:

  1. Get full hash of head twt
  2. Search for twts
    • in SQL: head_full_hash like subject || '%' and created_on > head_timestamp

The assumption being replies will be for the most recent head. If replying to an older one it will use a longer hash.

⤋ Read More
In-reply-to » @movq I'd love it if you write up a page for jenny 🙏 at https://twtxt.dev 🤞

@prologic@twtxt.net I wanted to wait for things to settle down. It’s still unclear to me in which direction we’re going – and if that new/different stuff is even possible to implement in jenny. That said, I’ve been really busy with private stuff these last few days, I’ve lost track of most of what you’re discussing. 🥴

⤋ Read More
In-reply-to » There we go!

@prologic@twtxt.net Regarding the new way of generating twt-hashes, to me it makes more sense to use tabs as separator instead of spaces, since the you can just copy/past a line directly from a twtxt-file that already go a tab between timestamp and message. But tabs might be hard to “type” when you are in a terminal, since it will activate autocomplete…🤔

Another thing, it seems that you sugget we only use the domain in the hash-creation and not the full path to the twtxt.txt

$ echo -e "https://example.com 2024-09-29T13:30:00Z Hello World!" | sha256sum - | awk '{ print $1 }' | base64 | head -c 12

⤋ Read More

RavenTree:輕量級的 Go HTTP 請求庫,內置重試機制和錯誤處理
RavenTree 是一個輕量級的 Go 庫,旨在通過提供易於使用的接口、內置對各種 HTTP 方法的支持、接受重試處理等功能來簡化 HTTP 請求。它爲開發者提供了一種高效便捷的方式與網絡服務進行交互。RavenTree 的核心功能—————易於使用的接口:  RavenTree 提供了一個簡單直觀的 API,可以方便地創建和發送 HTTP 請求。 內置支持各種 HTT ⌘ Read more

⤋ Read More

Golang 中你應該知道的 noCopy 策略
在 Go 開發中,我們經常遇到 noCopy 這種結構體,並伴隨一個常見的註釋 “must not be copied after first use”。本文將深入探討 noCopy 的作用,以及 Go Vet 如何幫助我們避免潛在的錯誤。sync.noCopy 的作用—————–sync.noCopy 結構體通常與 sync.WaitGroup 等同步原語一起出現,例如:t ⌘ Read more

⤋ Read More
In-reply-to » This is only first draft quality, but I made some notes on the #twtxt v2 proposal. http://a.9srv.net/b/2024-09-25

@anth@a.9srv.net you wrote:

“Edits and Deletions should go; see also Section 6. This is probably the worst example of this document pushing a text document to do more protocol-like things.”

Edit and deletions are precisely what brought us here. Currently, if one replies to a twtxt, and the original gets later edited, it breaks replies, and potentially drastically changes context.

⤋ Read More

Go 語言與 SQL 數據庫的交互方式
Go 語言作爲一門簡潔高效的語言,在與關係型數據庫交互方面也擁有着豐富的選擇。本文將深入探討 Go 語言中幾種常見的與 SQL 數據庫交互方式,並通過示例代碼、優缺點分析和擴展知識點,幫助你更好地理解和選擇適合你的方案。Go 語言與 SQL 數據庫交互的常見方式———————Go 語言標準庫提供了database/sql包,它是一個基礎的 SQL 數據庫驅動接口,爲各種 ⌘ Read more

⤋ Read More

Golang 實用技巧:使用 go-nanoid 高效生成唯一隨機 ID
作爲一名程序員,我們經常會遇到需要生成唯一標識符(ID)的場景。不管是創建用戶 ID、訂單號還是其他需要唯一性的數據,生成隨機且唯一的 ID 是保證系統健壯性的基礎之一。在 Go 語言中,有很多方法可以實現這一功能,今天我想和大家聊聊如何使用 go-nanoid 這個庫來生成隨機的唯一 ID。go-nanoid 是一個 Go 語言庫,用來高效地生成唯一的隨機 ID(類似於 UUID),並且生成的 ⌘ Read more

⤋ Read More

Starting a couple of new projects (geez where do I find the time?!):

HomeTunnel:

HomeTunnel is a self-hosted solution that combines secure tunneling, proxying, and automation to create your own private cloud. Utilizing Wireguard for VPN, Caddy for reverse proxying, and Traefik for service routing, HomeTunnel allows you to securely expose your home network services (such as Gitea, Poste.io, etc.) to the Internet. With seamless automation and on-demand TLS, HomeTunnel gives you the power to manage your own cloud-like environment with the control and privacy of self-hosting.

CraneOps:

craneops is an open-source operator framework, written in Go, that allows self-hosters to automate the deployment and management of infrastructure and applications. Inspired by Kubernetes operators, CraneOps uses declarative YAML Custom Resource Definitions (CRDs) to manage Docker Swarm deployments on Proxmox VE clusters.

⤋ Read More
In-reply-to » Some more arguments for a local-based treading model over a content-based one:

And finally the legibility of feeds when viewing them in their raw form are worsened as you go from a Twt Subject of (#abcdefg12345) to something like (https://twtxt.net/user/prologic/twtxt.txt 2024-09-22T07:51:16Z).

⤋ Read More
In-reply-to » Some more arguments for a local-based treading model over a content-based one:

There is also a ~5x increase cost in memory utilization for any implementations or implementors that use or wish to use in-memory storage (yarnd does for example) and equally a 5x increase in on-disk storage as well. This is based on the Twt Hash going from a 13 bytes (content-addressing) to 63 bytes (on average for location-based addressing). There is roughly a ~20-150% increase in the size of individual feeds as well that needs to be taken into consideration (on the average case).

⤋ Read More
In-reply-to » Some more arguments for a local-based treading model over a content-based one:

So really your argument is just that switching to a location-based addressing “just makes sense”. Why? Without concrete pros/cons of each approach this isn’t really a strong argument I’m afraid. In fact I probably need to just sit down and detail the properties of both approaches and the pros/cons of both.

I also don’t really buy the argument of simplicity either personally, because I don’t technically see it much more difficult to take a echo -e "<url>\t<timestamp>\t<content>" | sha256sum | base64 as the Twt Subject or concatenating the <url> <timestamp> – The “effort” is the same. If we’re going to argue that SHA256 or cryptographic hashes are “too complicated” then I’m not really sure how to support that argument.

⤋ Read More

Gorm 自定義數據類型
在處理數據庫交互時,我們經常會遇到將數據在 Go 結構體和數據庫關係之間來回轉換的需求。今天,我們將深入探討 Gorm 中的自定義數據類型,這是一種強大的工具,可以幫助我們實現靈活的數據映射和自定義邏輯。使用場景:處理軍官等級———–爲了更好地理解自定義數據類型的用途,我們以一個現實的例子來說明:構建一個軟件來存儲和讀取美軍軍官的等級信息。這個例子中,我們定義了兩個結構體:Go 結構 ⌘ Read more

⤋ Read More

Go 語言併發編程之互斥鎖 sync-Mutex
大家好,我是 frank。「Golang 語言開發棧」公衆號作者。01 介紹Go 標準庫 sync 提供互斥鎖 Mutex。它的零值是未鎖定的 Mutex,即未被任何 goroutine 所持有,它在被首次使用後,不可以複製。我們可以使用 Mutex 限定同一時間只允許一個 goroutine 訪問和修改臨界區。02 使用在介紹怎麼使用 Mutex 之前,我們先閱讀 sync.Mutex 源碼 ⌘ Read more

⤋ Read More

👋 Reminder folks of the upcoming Yarn.social monthly online meetup:

I hope to see @david@collantes.us @movq@www.uninformativ.de @lyse@lyse.isobeef.org @xuu@txt.sour.is @sorenpeter@darch.dk and hopefully others too @aelaraji@aelaraji.com @falsifian@www.falsifian.org and anyone else that sees this! 🙏 We’re hopefully going to primarily discuss the future of Twtxt and the last few weeks of discussions 🤣

  • Event: Yarn.social Online Meetup
  • When: 28th September 2024 at 12:00pm UTC (midday)
  • Where: Mills Meet : Yarn.social
  • Cadence: 4th Saturday of every Month

Agenda:

  • Let’s talk about the upcoming changes to the Twtxt spec(s)

#Yarn.social #Meetup

⤋ Read More

Halfbrick+ Lets You Play Popular iOS Games Like Fruit Ninja, Jetpack Joyride and Mega Jump for $2.99/Month
Halfbrick Studios is a game company best known for super popular iOS titles like Fruit Ninja and Jetpack Joyride, which have historically been freemium titles. Starting last year, Halfbrick decided to go with a different monetization model, offering all of its games for a low monthly fee.

Image

[Halfb … ⌘ Read more

⤋ Read More

go:embed 在 Go 開發中的應用與最佳實踐
背景–在使用 Go 開發命令行工具或桌面軟件時,將配置文件、模板,甚至整個前端應用直接嵌入到 Go 二進制文件中是一種提高應用部署效率和簡化操作的有效方法。這種方法可以減少外部依賴,讓應用在沒有額外資源文件的情況下也能獨立運行,特別適合需要便捷分發和部署的場景。自 Go 1.16 版本起,Go 語言官方引入了 //go:embed 指令,使得嵌入靜態資源變得異常簡單而直接。這一新特性大大簡化了 ⌘ Read more

⤋ Read More

基於反射的輕量級 Go 依賴注入框架
在軟件開發領域,依賴注入(DI)是一種強大的設計模式,它可以幫助我們編寫鬆散耦合、易於測試和維護的代碼。雖然在 Go 語言中,依賴注入的使用不如其他語言(如 Java 或 C#)那麼普遍,但在構建大型、複雜的應用程序時,它仍然可以發揮重要作用。Parsley 就是爲此而生的。它是一個易於使用、基於反射的 Go 依賴注入包,可以無縫地集成到任何 Go 應用程序中。Parsley——-Pars ⌘ Read more

⤋ Read More

構建 Go RESTful API 的終極指南:Fiber、GORM 和 PostgreSQL
本文將帶你一步步構建一個基於 Go、Fiber 和 GORM 的 RESTful API,並使用 PostgreSQL 作爲數據庫。我們將涵蓋從項目搭建、數據庫配置到 API 路由、認證、授權、錯誤處理等關鍵環節,並附有完整代碼示例和詳細解釋,幫助你快速上手 Go RESTful API 開發。項目搭建—-首先,我們需要創建一個新的 Go 項目並安裝必要的依賴包。 初始化 Go 模塊go mo ⌘ Read more

⤋ Read More

I wrote some code to try out non-hash reply subjects formatted as (replyto ), while keeping the ability to use the existing hash style.

I don’t think we need to decide all at once. If clients add support for a new method then people can use it if they like. The downside of course is that this costs developer time, so I decided to invest a few hours of my own time into a proof of concept.

With apologies to @movq@www.uninformativ.de for corrupting jenny’s beautiful code. I don’t write this expecting you to incorporate the patch, because it does complicate things and might not be a direction you want to go in. But if you like any part of this approach feel free to use bits of it; I release the patch under jenny’s current LICENCE.

Supporting both kinds of reply in jenny was complicated because each email can only have one Message-Id, and because it’s possible the target twt will not be seen until after the twt referencing it. The following patch uses an sqlite database to keep track of known (url, timestamp) pairs, as well as a separate table of (url, timestamp) pairs that haven’t been seen yet but are wanted. When one of those “wanted” twts is finally seen, the mail file gets rewritten to include the appropriate In-Reply-To header.

Patch based on jenny commit 73a5ea81.

https://www.falsifian.org/a/oDtr/patch0.txt

Not implemented:

  • Composing twts using the (replyto …) format.
  • Probably other important things I’m forgetting.

⤋ Read More
In-reply-to » I setup and switched to Headscale last night. It was relatively simple, I spent more time installing a web GUI to manage it to be honest, the actual server is simple enough. The native Tailscale Android app even works with it thankfully.

@eldersnake@we.loveprivacy.club I wanted to ask you, are you running Headscale and WireGuard on the same VPS? I want to test Headscale, but currently run a small container with WireGuard, and I wonder if I need to stop (and eventually get rid of) the container to get Headscale going. Did you use the provided .deb to install Headscale, or some other method?

⤋ Read More
In-reply-to » Apple A16 SoC Now Manufactured In Arizona "Apple has begun manufacturing its A16 SoC at the newly-opened TSCM Fab 21 in Arizona," writes Slashdot reader NoMoreACs. AppleInsider reports: According to sources of Tim Culpan, Phase 1 of TSMC's Fab 21 in Arizona is making the A16 SoC of the iPhone 14 Pro in "small, but significant, numbers. The production is largely a test for the facility at this stage, but more production is expected ... ⌘ Read more

@eldersnake@we.loveprivacy.club there has to be less reliance on a single point of failure. It is not so much about creating jobs in the US (which come with it, anyway), but about the ability to produce what’s needed at home too. What’s the trade off? Is it going to be a little bit more expensive to manufacture, perhaps?

⤋ Read More

Golang 實現 IP 地址掃描
你是否想過哪些設備連接到了家裏的 Wi-Fi 網絡?無論是出於安全目的還是單純的好奇心,我們都可以去了解一下家庭網絡中的設備情況。在本文中,我們將介紹如何使用 Go 構建一個簡單的 IP 地址掃描器,它可以掃描家庭網絡並列出所有活動設備。爲什麼要構建 Ip scanner市面上有很多網絡掃描工具,但自己構建網絡掃描工具能讓我們靈活地理解和修改代碼,以滿足需求。此外,這還是學習 Go 網絡編程的好方 ⌘ Read more

⤋ Read More

如何用 Go 來構建 LLM 應用
隨着大型語言模型(LLM)及其相關工具(如嵌入模型)在過去一年中能力顯著提升,越來越多的開發者考慮將 LLM 集成到他們的應用程序中。由於 LLM 通常需要專用硬件和大量計算資源,它們通常作爲網絡服務打包,提供 API 供訪問。這就是 OpenAI 和 Google Gemini 等領先 LLM 的 API 工作方式;即使是像 Ollama 這樣的自託管 LLM 工具,也將 LLM 封裝在 RES ⌘ Read more

⤋ Read More

Golang 使用 upx 減少可執行文件的大小
衆所周知,Golang 的編譯速度是非常之快的。在設計 Go 時,編譯速度是一個重要的考慮因素。但是,你是否關注過 Go 編譯代碼後生成的二進制可執行文件的大小?讓我們來看一個簡單的 HTTP 服務的應用示例:import (       ”fmt”       ”net/http” )   func main() {       // create a http server and creat ⌘ Read more

⤋ Read More

I have configured my twtxt.txt as simple as possible. I have setup a publish_command on jenny. Hopefully all works fine, and I am good to go. Next will be setting the announce_me to true. Here we go!

⤋ Read More
In-reply-to » I’m not advocating in either direction, btw. I haven’t made up my mind yet. 😅 Just braindumping here.

@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

Regarding jenny development: There have been enough changes in the last few weeks, imo. I want to let things settle for a while (potential bugfixes aside) and then I’m going to cut a new release.

And I guess the release after that is going to include all the threading/hashing stuff – if we can decide on one of the proposals. 😂

⤋ 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 » @bender I should put the template that is used by default as a file in the repo. Look at the source for now and you'll see 😅

@aelaraji@aelaraji.com this is my change on main.go (but it can be done on a template now, so no reason to touch the code):

                                 <time class="dt-published" datetime="{{ $twt.Created | date "2006-01-02T15:04:05Z07:00" }}">
                                        {{ $twt.Created | date "2006-01-02 15:04:05 MST" }}
                                  </time>

See https://ferengi.one. I am going to further customise things, but that’s a start.

⤋ Read More
In-reply-to » Now WTF!? Suddenly, @falsifian's feed renders broken in my tt Python implementation. Exactly what I had with my Go rewrite. I haven't touched the Python stuff in ages, though. Also, tt and tt2 do not share any data at all.

@lyse@lyse.isobeef.org Sorry, I don’t think I ever had charset=utf8. I just noticed that a few days ago. OpenBSD’s httpd might not support including a parameter with the mime type, unfortunately. I’m going to look into it.

⤋ Read More
In-reply-to » @movq Non-ASCII characters were broken. Like U+2028, degrees (°), etc.

Now WTF!? Suddenly, @falsifian@www.falsifian.org’s feed renders broken in my tt Python implementation. Exactly what I had with my Go rewrite. I haven’t touched the Python stuff in ages, though. Also, tt and tt2 do not share any data at all.

By any chance, did you remove the ; charset=utf-8 from your Content-Type: text/plain header, falsifian?

Image

⤋ Read More
In-reply-to » Hmmmm, I somehow run into an encoding problem where my inserted data end up mangled in the database. But, both SQLite and Go use UTF-8. What's happening here? :-?

@movq@www.uninformativ.de Non-ASCII characters were broken. Like U+2028, degrees (°), etc.

Turns out I used a silly library to detect the encoding and transform to UTF-8 if needed. When there is no Content-Type header, like for local files, it looks at the first 1024 bytes. Since it only saw ASCII in that region, the damn thing assumed the data to be in Windows-1252 (which for web pages kinda makes sense):

// TODO: change default depending on user's locale?
return charmap.Windows1252, "windows-1252", false

https://cs.opensource.google/go/x/net/+/master:html/charset/charset.go;l=102

This default is hardcoded and cannot be changed.

Trying to be smart and adding automatic support for other encodings turned out to be a bad move on my end. At least I can reduce my dependency list again. :-)

I now just reject everything that explicitly specifies something different than text/plain and an optional charset other than utf-8 (ignoring casing). Otherwise I assume it’s in UTF-8 (just like the twtxt file format specification mandates) and hope for the best.

⤋ 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

Apple Releases tvOS 18 With InSight, New Screen Savers and More
Apple today released tvOS 18, the newest version of the tvOS operating system that runs on the Apple TV 4K and ‌Apple TV‌ HD models.

Image

tvOS 18 can be downloaded using the Settings app on the ‌‌Apple TV‌‌. Open up Settings and go to System > Software Update to get the new software. ‌‌Apple TV‌‌ owners who have automatic softwa … ⌘ Read more

⤋ Read More

Something odd just happened to my twtxt timeline… A bunch of twts dissapered, others were marked to be deleted in mutt. so I nuked my whole twtxt Maildir and deleted my ~/.cache/jenny in order to start with a fresh Pull. I pulled feed as usual. Now like HALF the twts aren’t there 😂 even my my last replay. WTF IS GOING ON? 🤣🤣🤣

⤋ 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
In-reply-to » On the Subject of Feed Identities; I propose the following:

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
In-reply-to » On the Subject of Feed Identities; I propose the following:

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
In-reply-to » On the Subject of Feed Identities; I propose the following:

@mckinley@twtxt.net To answer some of your questions:

Are SSH signatures standardized and are there robust software libraries that can handle them? We’ll need a library in at least Python and Go to provide verified feed support with the currently used clients.

We already have this. Ed25519 libraries exist for all major languages. Aside from using ssh-keygen -Y sign and ssh-keygen -Y verify, you can also use the salty CLI itself (https://git.mills.io/prologic/salty), and I’m sure there are other command-line tools that could be used too.

If we all implemented this, every twt hash would suddenly change and every conversation thread we’ve ever had would at least lose its opening post.

Yes. This would happen, so we’d have to make a decision around this, either a) a cut-off point or b) some way to progressively transition.

⤋ 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
In-reply-to » On the Subject of Feed Identities; I propose the following:

@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
In-reply-to » When we passed a few horses in the forest, there was really strong soup odor in the air. It didn't smell like horse at all, but soup. Maybe they've been soup horses, chickens were out of stock.

@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

When we passed a few horses in the forest, there was really strong soup odor in the air. It didn’t smell like horse at all, but soup. Maybe they’ve been soup horses, chickens were out of stock.

29°C, zero wind, extremely humid, luckily the sun was behind the clouds. I’m soaking wet, sweat ran down in streams and dripped in my eyes, it burned a bit. The sky is getting a little dark, I hope the thunderstorm and rain are really arriving here later. Rain had always been finally cancelled the couple last days.

I’m gotta go cool off my fingers now, they’re swollen from the heat.

⤋ Read More
In-reply-to » Serious open (for anyone) question: what makes you follow someone on twtxt? Will you just follow anyone that you come across, simply because that someone using the "decentralised, minimalist microblogging service for hackers" microblog?

@bender@twtxt.net On twtxt, I follow all feeds that I can find (there are some exceptions, of course). There’s so little going on in general, it hardly matters. 😅

And I just realized: Mutt’s layout helps a lot. Skimming over new twts is really easy and it’s not a big loss if there are a couple of shitposts™ in my “timeline”. This is very different from Mastodon (both the default web UI and all clients I’ve tried), where the timeline is always huge. Posts take up a lot of space on screen. Makes me think twice if I want to follow someone or not. 😅

(I mostly only follow Hashtags on Mastodon anyway. It’s more interesting that way.)

⤋ 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