Searching txt.sour.is

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

用 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
In-reply-to » Telegram founder Pavel Durov arrested at French airport Article URL: https://www.theguardian.com/media/article/2024/aug/24/telegram-app-founder-pavel-durov-arrested-at-french-airport

@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
In-reply-to » Telegram founder Pavel Durov arrested at French airport Article URL: https://www.theguardian.com/media/article/2024/aug/24/telegram-app-founder-pavel-durov-arrested-at-french-airport

@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

Golang 面試題:strings 和 strconv 包
作爲一種基本數據結構,每種語言都有一些對於字符串的預定義處理函數。Go 中使用 strings 包來完成對字符串的主要操作。4.7.1 前綴和後綴———–HasPrefix 判斷字符串 s 是否以 prefix 開頭:strings.HasPrefix(s, prefix string) boolHasSuffix 判斷字符串 s 是否以 suffix 結尾:strings.HasS ⌘ Read more

⤋ Read More

一款支持自動流水線和客戶端緩存的 Go 語言 Redis 客戶端
Rueidis 是一款高性能的 Go 語言 Redis 客戶端,它支持自動流水線操作和服務端輔助客戶端緩存等功能。Rueidis 的目標是提供一個簡單易用、性能卓越的 Redis 客戶端庫,以滿足 Go 開發者的各種需求。主要功能—-自動流水線操作,提升非阻塞命令的執行效率 服務端輔助客戶端緩存,大幅降低延遲和提高吞吐量 支持泛型對象映射和客戶端緩存 提供緩存策略模式(Cac ⌘ Read more

⤋ Read More

Viper:強大的 Go 配置解析庫
1 介紹Viper (https://github.com/spf13/viper) 是適用於 Go 應用程序的完整配置解決方案。它被設計用於在應用程序中工作,並且可以處理所有類型的配置需求和格式。目前 Star 26.6k, 它支持以下特性:設置默認值 從 JSON、TOML、YAML、HCL、envfile 和 Java properties 格式的配置文件讀取配置信息 實時監控和 ⌘ Read more

⤋ Read More

你知道 golang 中 sysmon 有什麼作用嗎?
在 Go 語言的運行時 (runtime 包) 中,sysmon 是一個系統監視器 (system monitor) 線程,它在 Go 運行時中扮演着非常重要的角色。sysmon 的主要職責是維護 Go 程序的健壯性和響應性,確保垃圾回收 (Garbage Collection, GC)、搶佔調度 (Preemptive Scheduling)、定時器 (Timers) 和一些其他後臺任務能夠及時 ⌘ Read more

⤋ Read More

Golang 高併發應用中的數據庫連接死鎖
在構建高併發的 Go 應用時, 數據庫連接池的使用是不可或缺的。然而, 如果使用不當, 連接池也可能成爲性能瓶頸, 甚至導致整個應用陷入死鎖。本文將深入探討 Golang 中數據庫連接死鎖的原因、影響以及解決方案, 幫助開發者構建更加健壯的應用程序。數據庫連接池的工作原理———–在深入討論連接死鎖之前, 我們需要先了解數據庫連接池的工作原理。連接池本質上是一個連接的緩存, 它可以避免 ⌘ Read more

⤋ Read More
In-reply-to » Came across YTCH yesterday, and it is very addictive. Simple, and well done. You can host it yourself if you want. The trick I haven't figure out yet is how to create the list.json that drives it.

Its like old school TV but with youtube videos. Each channel has a subject and the channels play in a sort of realtime. so no going forward or back. Perfect for channel surfing.

⤋ Read More
In-reply-to » Came across YTCH yesterday, and it is very addictive. Simple, and well done. You can host it yourself if you want. The trick I haven't figure out yet is how to create the list.json that drives it.

Its like old school TV but with youtube videos. Each channel has a subject and the channels play in a sort of realtime. so no going forward or back. Perfect for channel surfing.

⤋ Read More

Go 語言什麼時候該使用指針?指針使用的分析與講解
什麼是指針 我們都知道,程序運行時的數據是存放在內存中的,每一個存儲在內存中的數據都有一個編號,這個編號就是內存地址。我們可以根據這個內存地址來找到內存中存儲的數據,而內存地址可以被賦值給一個指針。我們也可以簡單的理解爲指針就是內存地址。指針的聲明和定義 在 Go 語言中,獲取一個指針,直接使用取地址符 & 就可以。 示例:func main() {  name := ”Go語言圈”  na ⌘ Read more

⤋ Read More

Go: string 和 bytes 四種轉換方式的性能比較
昨天公司羣中同事提到 Go 1.22 中 string 和 bytes 的互轉不需要再用 unsafe 那個包了,直接轉就可以。我翻看了 Go 1.22 的 release notes 沒找到相應的介紹,但是大家提到了 kubernetes 的 issue[1] 中有這個說法: As of go 1.22, for string to bytes conversion, we can repla ⌘ Read more

⤋ Read More

The benefits of mentoring and the CNCF Mentorship Program
By Nate Waddington, Head of Mentorship & Documentation, CNCF Technical people have a world of opportunities available to them when it comes to boosting career skills. But I’m going to make the case for taking a somewhat old-fashioned… ⌘ Read more

⤋ Read More

沒有什麼不可能:修改 Go 結構體的私有字段
在 Go 語言中, 結構體 (struct) 中的字段如果是私有的, 只能在定義該結構體的同一個包內訪問。這是爲了實現數據的封裝和信息隱藏, 提高代碼的健壯性和安全性。但是在某些情況下, 我們可能需要在外部包中訪問或修改結構體的私有字段。這時, 我們可以使用 Go 語言提供的反射 (reflect) 機制來實現這一功能。即使我們能夠實現訪問,這些字段你沒有辦法修改,如果嘗試通過反射設置這些私有字段 ⌘ Read more

⤋ Read More

Go 語言的流式處理特性進行高效的 HTTP 請求
在 Go 語言中,當你發起一個 HTTP 請求時,可以通過多種方式來將數據寫入請求的body部分。如果你要處理大型數據或者需要逐步生成請求體數據而不想一次性加載到內存中,可以使用流式寫入的方式。這裏我們會討論如何使用io.Reader接口來實現 HTTP 請求體的流式寫入。1. 基礎概念在 Go 語言的 HTTP 庫中,HTTP 請求的Body字段是一個io.Reader接口。因此,你可以通過實現 ⌘ Read more

⤋ Read More

Go 語言構建可擴展的 Worker Pool
在當今數據驅動的世界中,應用程序需要快速高效地處理大量請求。併發處理通過允許程序同時執行多個任務,成爲解決這一需求的關鍵。Go 語言以其強大的併發原語而聞名,爲構建高性能、可擴展的應用程序提供了優雅而有效的方法。本文將深入探討併發處理的概念,並提供使用 Go 語言構建可擴展 Worker Pool 的分步指南。併發處理:性能和效率的強大工具—————併發處理涉及程序內多個任務的 ⌘ Read more

⤋ Read More

圖解 Go 語言 time-Sleep 的實現原理
我們寫程序的時候,一定遇到過需要讓程序休眠一段時間再執行的場景,這個時候我們一般會想到用 Sleep 方法,Java 語言有Thread.Sleep, PHP 應該是有一個sleep函數,同樣的 Go 語言有內置的 time.Sleep 方法。這篇文章我們來簡單梳理一下,Go 語言的time.Sleep是怎麼實現程序的休眠和喚醒的。在 Go 的程序中,使用time.Sleep(d duration ⌘ Read more

⤋ Read More

通過 Go 示例理解函數式編程思維
一個孩子要嘗試 10 次、20 次才肯接受一種新的食物,我們接受一種新的範式,大概不會比這個簡單。– 郭曉剛 《函數式編程思維》譯者函數式編程 (Functional Programming, 簡稱 fp) 是一種編程範式,與命令式編程(Imperative Programming)、面向對象編程(OOP)、泛型編程(Generics Programming)、邏輯編程 (logic Pro ⌘ Read more

⤋ Read More

從源代碼中窺探 Go 的 WaitGroup 實現和應用
sync.WaitGroup OverviewGo 作爲雲原生開發的代表,以其在併發編程中的易用性而聞名。在大多數情況下,人們會在處理併發時使用 WaitGroup。我經常想要了解它是如何工作的,所以本文主要談談我對 WaitGroup 的理解。在 Go 語言中,sync.WaitGroup 允許主程序或其他 goroutines 在繼續執行之前等待多個 goroutines 執行完畢。它主要用於 ⌘ Read more

⤋ Read More

一文搞定 Golang 反射 -Reflect-
Go (Golang) 中的反射是一項強大的功能,它允許程序在運行時檢查自身的結構和值。這一功能由 reflect 包提供。反射通常用於序列化 / 反序列化、構建泛型庫和測試等任務。本文將概述反射在 Go 中的工作原理,並提供實際示例。基本概念Type: 值的類型,(如 int、string、float、struct)。 Value: 變量的實際數據。 kind: 類型的具體類別(如 ⌘ Read more

⤋ Read More

Today, after the daily standup (without standup though), I went to pick up my girlfriend’s exam paper. But instead of using car sharing or the bus, I decided to go there by bike. This time with my older city bike. Faster than the bus, cheaper than car sharing. And it was a nice break from work. Hurray for flextime and working from home, which makes this possible for me! ⌘ Read more

⤋ Read More

Installing multiple helm charts in one go [Approach 3 – using simple bash utility]
Community post originally published on Dev.to by Sunny Bhambhani In this article, we will be talking about Approach 3 i.e. how to get multiple helm charts installed using a simple bash utility. If you haven’t read the previous… ⌘ Read more

⤋ Read More

Disney Raising Prices for Hulu, ESPN+, and Disney+ This Fall
Disney will soon increase the cost of its suite of streaming services, including Hulu, ESPN+, and Disney+. Prices will go up for both ad-supported and ad-free plans, and some of Disney’s bundles will also be more expensive. Most plans are increasing by $1 to $2.

Image

  • Disney+ With Ads - $9.99, up from … ⌘ Read more

⤋ Read More

在 golang 裏使用 ZooKeeper,如何使用
在 Go 語言中使用 ZooKeeper,可以藉助第三方庫go-zookeeper。下面介紹如何安裝和使用這個庫與 ZooKeeper 進行交互。安裝 go-zookeeper 庫首先,需要安裝go-zookeeper庫。使用go get命令來安裝:go get github.com/samuel/go-zookeeper/zk使用 ZooKeeper 的基本示例以下是一個簡單的示例,包括連接 Z ⌘ Read more

⤋ Read More

適配器模式在 Go 語言中的應用
前段時間我負責對一個項目進行臨時性的技術方案改造,用到了適配器模式,今天就來跟大家簡單分享下適配器模式在 Go 語言中的應用。適配器模式適配器模式(Adapter Pattern)是 23 種經典設計模式中的一種,屬於行爲型模式,它允許不兼容的接口協同工作。該模式通過創建一個適配器類,封裝不兼容的接口,並對外提供一個兼容的接口。《設計模式:可複用面向對象軟件的基礎》一書中對適配器的意圖定義如下: ⌘ Read more

⤋ Read More

用 Go 語言構建優雅的事件驅動架構
事件驅動架構(EDA)作爲一種強大的軟件設計模式,在構建現代分佈式系統中扮演着越來越重要的角色。它通過異步事件流將不同的服務和組件解耦,從而提升系統的可擴展性、彈性和響應能力。在 Go 語言中,其簡潔的語法和豐富的併發原語爲實現高效的 EDA 提供了天然的優勢。事件驅動架構的核心概念———–在深入探討如何使用 Go 語言構建 EDA 之前,我們先來回顧一下事件驅動架構的核心概念:事件 ⌘ Read more

⤋ Read More
In-reply-to » @lyse As far as I know, they're still visible in the Web UI. Although, in the mobile app and youtube.com, I believe it tells you that the video isn't available without having to click on it. They don't tell you that in the RSS feed, and I agree; it gets annoying.

Definitely something going on here. Cloudflare is my main suspect.

⤋ Read More
In-reply-to » @lyse Ahh so it's not just me! 😅

@aelaraji@aelaraji.com Ahh it might very well be a Clownflare thing as @lyse@lyse.isobeef.org eluded to 🤣 One of these days I’m going to get off Clownflare myself, when I do I’ll share it with you. My idea is to basically have a cheap VPS like @eldersnake@we.loveprivacy.club has and use Wireguard to tunnel out. The VPS becomes the Reverse Proxy that faces the internet. My home network then has in inbound whatsoever.

⤋ Read More

患「僵人综合征」的席琳·迪翁再次亮相奥运会开幕式,如何评价她的表演?这种疾病可以被治愈吗?
奥主委选择席琳迪翁在开幕式献唱。

肯定不是因为她目前的嗓音完美无缺。

而是她拥有奥运最需要的。

人类永不言败的精神。

听到“ 僵人综合征”,很多人第一反应:

是不是周杰伦的“ 强直性脊柱炎”?

是不是京东蔡磊的“ 渐冻人“?

都不是。

僵人综合征是发病率百万分之一的罕见病。

即使贵为天后,席琳迪翁也被误诊了多年。

如此脆弱,又如此强大

因《泰坦尼克号》主题曲《My heart will go on》而爆红的音乐天后席琳·迪翁。

Image

她不仅是五届格莱美奖得主。

![](https://pic1.zhimg.com/v2-a90343fee3129bfc61 … ⌘ Read more

⤋ Read More

Go1-23 新特性:花了近 10 年,time-After 終於不泄漏了!
大家好,我是煎魚。好多年前,我寫過 timer.After 的使用和坑。Go 這麼多年以來這塊一直有內存泄露。有的同學或多或少都有遇到過。最近 Go1.23 即將正式發佈,Go 核心團隊負責人 rsc 自述花了將近 10 年的努力,終於把這個問題修復了。值得我們關注!timer.After 是什麼—————這是之前編寫的部分,我測試驗證了下。在 Go1.22 依然有效,仍然是有 ⌘ Read more

⤋ Read More

It’s my birthday today :) i was born 41 years go, 3.5 months too early. I was so small my parents had to buy doll clothes at the toy store. Gonna be a nice day today, celebrate with my family :) we always treasure birthdays.🎂

⤋ Read More

在 Go 中如何使用反射實現簡易版 encoding-json
在使用 Go 語言開發過程中,我們經常需要實現結構體到 JSON 字符串的序列化(Marshalling)或 JSON 字符串到結構體的反序列化(Unmarshalling)操作。Go 爲我們提供了 encoding/json 庫可以很方便的實現這一需求。在本文中,我們將探索如何使用 Go 的反射機制自己來實現一個簡易版的 encoding/json 庫。這個過程不僅能幫助我們理解序列化和反序列化 ⌘ Read more

⤋ Read More

Go 還是 TinyGo?
什麼是 TinyGo?TinyGo 與 Go 有何不同? TinyGo 與 Go 相比性能如何?什麼是 TinyGo?———–TinyGo 不是另一種編程語言。它只是 Go 語言的一個編譯器。關鍵區別在於 TinyGo 編譯器創建的二進制文件更小, 主要用於嵌入式系統和 WASM。而 Go 編譯器則用於編譯完整的服務器端應用程序和通用程序。TinyGo 使用 LLVM 作爲後端, 與 ⌘ Read more

⤋ Read More

你是如何用 Go 語言 配置高性能 sql-DB 的?
配置高性能的 sql.DB 是 Go 應用程序開發中一個重要的環節,特別是在需要處理大量數據庫查詢的情況下。以下是一些最佳實踐和配置建議:1. 數據庫連接池的配置Go 的 database/sql 包提供了連接池的功能,您可以通過設置最大空閒連接、最大打開連接數和連接的最大生命週期來優化連接池。db, err := sql.Open(“mysql”, ”user:password@tcp(127. ⌘ Read more

⤋ 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.

@prologic@twtxt.net Yes I suppose that is true. There is an article on Tailscale’s site that explains it all quite a bit: https://tailscale.com/blog/how-nat-traversal-works

To me, with CGNAT, it’s a small miracle that a direct connection can be made between peers (as opposed to going through a relay constantly) but it does indeed work. I guess to host it at home you would need to have it WAN accessible, and if you’ve already gone to the trouble of port forwarding etc… well 😅
Not that I could personally do that, but for those with static IPs etc.

⤋ Read More

Lambda-Go:將函數式編程引入 Go
函數式編程是編程範式當中的一種,喜歡的人愛之如命,不喜歡的人嗤之以鼻,以簡單高效著稱的 Go 天然在函數式編程上有自己的優勢。Lambda-Go[1] 是一個旨在將受 Haskell 啓發的函數式編程技術引入 Go 生態系統的庫。在本文中,我們將探討 Lambda-Go 的功能,以及它如何增強你的 Go 編程體驗。Lambda-Go 簡介Lambda-Go 是一個 Go 庫,它通過函數式編程結構擴 ⌘ Read more

⤋ Read More
In-reply-to » Bought a motorcycle this summer, I did not want two cars, and Marlyn would like to have the car more when I'm at work. So I bought a new cheap motorcycle, KTM Adventure 390. It's been 10 years since I last had a motorcycle (back then I had a KTM 990cc). Here I am with my daughter on the new bike :) My kids love to go for rides, so does Marlyn as well, so it's a lot of fun for all of us. Media

@bender@twtxt.net It cost what you mentioned here too, but they had a special discount, and the shop gave 20% discount for all the gear we needed (since I bought the bike + gear for two persons), so all in all I got a really good deal on it. Also interest rate is locked for 3 years (low rate) so that was also a good deal.
I just took the longest time I could on the loan, to have a low price each month, and then i just pay extra whenever I can to get it payed down faster.
Luckily the Marlyn, my son, and my daughter all fit the same gear, so the 3 of them share that, that saved a lot of money too :)

When i met Marlyn (before we had kids) I asked here to go on her first trip with me (I had a bike before I met her back then), and we went on a 2 week ride from Norway to Italy and back (venice) through the alps and all that. Was super fun, and I think it’s pretty cool of her to say yes to a 2 week trip as passenger :)

⤋ Read More

Bought a motorcycle this summer, I did not want two cars, and Marlyn would like to have the car more when I’m at work. So I bought a new cheap motorcycle, KTM Adventure 390.
It’s been 10 years since I last had a motorcycle (back then I had a KTM 990cc).
Here I am with my daughter on the new bike :)
My kids love to go for rides, so does Marlyn as well, so it’s a lot of fun for all of us.

Image

⤋ Read More

Go 異步編程小技巧
我們通過一個簡單的例子看一下 Goroutine 的使用func main() {    go func() {        fmt.Println(“Goroutine started”)        // do some work        fmt.Println(“Goroutine finished”)    }()    // wait for Goroutine to fini ⌘ Read more

⤋ Read More

Anyway, I’m gonna have to go to bed… We’ll continue this on the weekend. Still trying to hunt down some kind of suspected mult-GB avatar using @stigatle@yarn.stigatle.no ’s pod’s cache:

$ (echo "URL Bytes"; sort -n -k 2 -r < avatars.txt | head) | column -t
URL                                                                                                       Bytes
https://birkbak.neocities.org/avatar.jpg                                                                  667640
https://darch.neocities.org/avatar.png                                                                    652960
http://darch.dk/avatar.png                                                                                603210
https://social.naln1.ca/media/0c4f65a4be32ff3caf54efb60166a8c965cc6ac7c30a0efd1e51c307b087f47b.png        327947
...

But so far nothing much… Still running the search…

⤋ Read More
In-reply-to » @stigatle / @abucci My current working theory is that there is an asshole out there that has a feed that both your pods are fetching with a multi-GB avatar URL advertised in their feed's preamble (metadata). I'd love for you both to review this PR, and once merged, re-roll your pods and dump your respective caches and share with me using https://gist.mills.io/

@prologic@twtxt.net here you go:
https://drive.proton.me/urls/XRKQQ632SG#LXWehEZMNQWF

⤋ Read More
In-reply-to » @prologic hm, it seems to be full disk that's the issue, same problem with the avatar in tmp it seems that's mentioned earlier here. I deleted them now. I regained 33% space (9GB).

@prologic@twtxt.net I got it working, I reinstalled go under home (instead of where go wiki tells me to install it), and pointed to that, as well as the variables you mentioned, that enabled me to compile it. deleted the old yarnd , and made sure I run the new one.
Thanks for the help (as always :) ).

⤋ Read More
In-reply-to » @prologic hm, it seems to be full disk that's the issue, same problem with the avatar in tmp it seems that's mentioned earlier here. I deleted them now. I regained 33% space (9GB).

@prologic@twtxt.net hm, I installed latest go (vps did not have that intalled), I then did make deps, then make server, when I use the last command it said minify was not installed, I assumed minify package was the one to get, but it fails with that. (debian).

⤋ Read More

Go 語言定時任務 time-Sleep 和 time-Tick 的優劣對比分析
golang 寫循環執行的定時任務,常見的有以下三種實現方式 1、time.Sleep 方法:for {   time.Sleep(time.Second)   fmt.Println(“我在定時執行任務”)}2、time.Tick 函數:t1:=time.Tick(3time.Second)for {   select {   case <-t1:      fmt.Println(“t1定時 ⌘ Read more

⤋ Read More

Golang - range 迭代器揭祕
簡介我們正在使用 Go 語言編寫 Dolt[1] ,這是世界上第一個版本控制的 SQL 數據庫。像大多數大型 Go 代碼庫一樣,我們有很多需要迭代的集合類型。 Go 1.23 的新特性 [2] 中,你現在可以使用 range 關鍵字來迭代自定義集合類型。這是如何工作的? 這是個好主意嗎? 讓我們深入探討一下。如果你想運行本教程中的任何代碼,你需要 安裝 Go 1.23 發佈候選版 [3] ,或者在 ⌘ Read more

⤋ Read More

使用 Go 語言創建你的第一個 2D 遊戲
Pixel 是一個用 Go 語言編寫的 2D 遊戲開發庫, 它爲開發者提供了一套簡潔而強大的工具, 讓創建像素風格的遊戲變得輕而易舉。本文將深入探討 Pixel 庫的核心特性, 並通過豐富的示例來展示如何使用它來構建引人入勝的 2D 遊戲。Pixel 的誕生與理念————Pixel 誕生於開發者對簡單而高效的 2D 遊戲開發工具的渴望。它的設計理念是 “手工打造”, 這意味着庫的每 ⌘ Read more

⤋ Read More

Genkit:新一代基於 Go 的 AI 應用開發框架
Google 推出了 Genkit for Go,這是一個開源框架,用來以 Go 語言原生構建 AI 應用與雲服務。該項目是 Google Firebase 和 Go 團隊聯手合作的最新成果。Genkit for Go 於 7 月 17 日正式推出,目前版本處於 alpha 階段。Gophers 能夠通過它將 Go 的性能和併發優勢與 Genkit 的庫和工具相結合,從而來構建生成式 AI 應用程 ⌘ Read more

⤋ Read More

Post-vacation bike tour
Today was my first workday after summer vacation, and with the weather being pleasant – not too hot, and no rain – I decided to finish work a bit early and go for a 39-kilometer bike tour through the surrounding area. ⌘ Read more

⤋ Read More
In-reply-to » I admit I've always compromised on this way too much myself, always to this day having Facebook Messenger just to communicate in my families group chats. Sure I run it in a Work profile on my GrapheneOS phone that I can switch off at any time, I can completely cut it off from network access any time as well, I can have a lot of rudimentary control over it, I use it as sparingly as possible, but it doesn't change the fact everytime I use it we're funneling private convos through bloody Meta's servers and trackers etc.

@movq@www.uninformativ.de

(I don’t really trust Android, though, and I suspect that apps can still install background services that are always active. Pure speculation and paranoid on my part, but still.)

Which is fair, but I would say the GrapheneOS devs in particular are also quite paranoid about this stuff and go to great pains to make sure this stuff can be controlled by the user.

⤋ Read More
In-reply-to » @xuu I have a theory as to why your pod was misbehaving too. I think because of the way you were building it docker build without any --build-arg VERSION= or --build-arg COMMIT= there was no version information in the built binary and bundled assets. Therefore cache busting would not work as expected. When introducing htmx and hyperscript to create a UI/UX SPA-like experience, this is when things fell apart a bit for you. I think....

@prologic@twtxt.net Yeah that is probably what was happening. I wish that go build could embed the values that go install does.

⤋ Read More
In-reply-to » @xuu I have a theory as to why your pod was misbehaving too. I think because of the way you were building it docker build without any --build-arg VERSION= or --build-arg COMMIT= there was no version information in the built binary and bundled assets. Therefore cache busting would not work as expected. When introducing htmx and hyperscript to create a UI/UX SPA-like experience, this is when things fell apart a bit for you. I think....

@prologic@twtxt.net Yeah that is probably what was happening. I wish that go build could embed the values that go install does.

⤋ Read More

Go 語言的 Lodash 風格庫
在 JavaScript 的世界裏,Lodash 是一個家喻戶曉的工具庫,它提供了豐富的函數,方便開發者操作數組、對象、字符串等等。Lodash 極大地提高了 JavaScript 開發者的效率,也讓代碼更加簡潔易讀。在 Go 語言 1.18 版本之前,由於缺乏泛型,我們很難實現像 Lodash 這樣功能強大且類型安全的工具庫。然而,隨着 Go 1.18 泛型的引入,這一切都發生了改變。sambe ⌘ Read more

⤋ Read More

Review: Ugreen Nexode 100W 20000mAh Power Bank Offers Ample Juice to Go
Popular accessory brand Ugreen has built up a veritable lineup of portable power banks and chargers in the last few years, with several options to serve the needs of gadget users on the road. It can be hard to work out what kind of unit will meet your particular requirements, but if you are looking for a compact USB-C/A bank that has enough juice to fully recharge your smartphone and laptop a … ⌘ Read more

⤋ Read More

在 Go 中如何使用 go:embed 指令嵌入靜態文件
有時候,將配置文件、模板甚至整個前端應用直接嵌入到 Go 二進制文件中,是一種提高應用部署效率和簡化操作的有效方法。自從 Go 1.16 版本起,Go 語言官方引入了 //go:embed 指令,這使得嵌入靜態資源變得異常簡單而直接。本文將詳細介紹如何在你的 Go 應用中使用這一強大的特性。什麼是 go:embed//go:embed 在 Go 1.16 版本中被加入,這也是我接觸 Go 語言的第 ⌘ Read more

⤋ Read More

理解並使用 Golang 的 “omitempty” 特性
在使用 Go (Golang) 並將數據編碼爲 JSON 時,您可能會遇到這樣的情況:如果某些字段的值爲空,則需要從編碼輸出中省略這些字段。這就是 Golang 的 omitempty 功能發揮作用的地方。struct 字段標記中的 omitempty 選項會告訴編碼器,如果字段爲空值,則跳過該字段。什麼是  “Empty Value”?在 Go 中,Empty Value 的定義是:布爾類型爲 ⌘ Read more

⤋ Read More

How to Install the macOS Sequoia Public Beta
Apple has made a macOS 15 Sequoia beta available for its public beta testing group, letting public beta testers try out the software before it launches this fall. Keep reading to learn whether you should install it on your Mac, and if so, how to go about it.

Image

Signing up to get the macOS Sequoia beta is simple, and can be done by enrolling a Mac in Apple’s free … ⌘ Read more

⤋ Read More

Kubestronaut in Orbit: Eleni Grosdouli
Get to know Eleni This week’s Kubstronaut in Orbit, Eleni Grosdouli, brings diverse experiences to her role as a DevOps Consulting Engineer at Cisco Systems. She’s the go-to person for DevOps and Kubernetes Automation, with a passion for… ⌘ Read more

⤋ Read More

通過實例理解 Go 訪問和操作數據庫的幾種方式
關係數據庫操作是 Go 應用開發中的重要一環,尤其是 Go Web 應用、微服務等。作爲 Gopher,我們需要了解幾種主流的數據庫訪問和操作方法,以便在項目中做出適當的選擇。我個人在日常開發中較少涉及 CRUD 類應用,因此使用 Go 訪問和操作數據庫的機會並不多,在這方面也算是有一些 “短板”。通過在這篇文章中對數據庫訪問方式進行全面的梳理,我也算是補全一下技能樹,同時也能爲讀者小夥伴提供一些 ⌘ Read more

⤋ Read More