for http3 there is
from my understanding.. i don’t know how the multiplexing works when its being proxied through another server. I know go has support for it if you call it out directly. https://pkg.go.dev/golang.org/x/net/http2
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.
Go 語言什麼時候該使用指針?指針使用的分析與講解
什麼是指針 我們都知道,程序運行時的數據是存放在內存中的,每一個存儲在內存中的數據都有一個編號,這個編號就是內存地址。我們可以根據這個內存地址來找到內存中存儲的數據,而內存地址可以被賦值給一個指針。我們也可以簡單的理解爲指針就是內存地址。指針的聲明和定義 在 Go 語言中,獲取一個指針,直接使用取地址符 & 就可以。 示例:func main() { name := ”Go語言圈” na ⌘ Read more
Go 1.23 is Released
1 points posted by John Doak ⌘ 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
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
Base: 6.00 miles, 00:09:43 average pace, 00:58:16 duration
i was suppose to go for another 30 minutes. my energy level is off and i may need to reassess some goals.
#running #treadmill
Go-between appointed to help Queensland farmers negotiate supermarket prices
Vegetable grower Carl Walker says farmers are worried the new commissioner’s powers won’t go far enough. He says farmers just want a “fair price for a fair day’s work”. ⌘ Read more
沒有什麼不可能:修改 Go 結構體的私有字段
在 Go 語言中, 結構體 (struct) 中的字段如果是私有的, 只能在定義該結構體的同一個包內訪問。這是爲了實現數據的封裝和信息隱藏, 提高代碼的健壯性和安全性。但是在某些情況下, 我們可能需要在外部包中訪問或修改結構體的私有字段。這時, 我們可以使用 Go 語言提供的反射 (reflect) 機制來實現這一功能。即使我們能夠實現訪問,這些字段你沒有辦法修改,如果嘗試通過反射設置這些私有字段 ⌘ Read more
Go 語言的流式處理特性進行高效的 HTTP 請求
在 Go 語言中,當你發起一個 HTTP 請求時,可以通過多種方式來將數據寫入請求的body部分。如果你要處理大型數據或者需要逐步生成請求體數據而不想一次性加載到內存中,可以使用流式寫入的方式。這裏我們會討論如何使用io.Reader接口來實現 HTTP 請求體的流式寫入。1. 基礎概念在 Go 語言的 HTTP 庫中,HTTP 請求的Body字段是一個io.Reader接口。因此,你可以通過實現 ⌘ Read more
Go 語言構建可擴展的 Worker Pool
在當今數據驅動的世界中,應用程序需要快速高效地處理大量請求。併發處理通過允許程序同時執行多個任務,成爲解決這一需求的關鍵。Go 語言以其強大的併發原語而聞名,爲構建高性能、可擴展的應用程序提供了優雅而有效的方法。本文將深入探討併發處理的概念,並提供使用 Go 語言構建可擴展 Worker Pool 的分步指南。併發處理:性能和效率的強大工具—————併發處理涉及程序內多個任務的 ⌘ Read more
Celestial Event
⌘ Read more
圖解 Go 語言 time-Sleep 的實現原理
我們寫程序的時候,一定遇到過需要讓程序休眠一段時間再執行的場景,這個時候我們一般會想到用 Sleep 方法,Java 語言有Thread.Sleep, PHP 應該是有一個sleep函數,同樣的 Go 語言有內置的 time.Sleep 方法。這篇文章我們來簡單梳理一下,Go 語言的time.Sleep是怎麼實現程序的休眠和喚醒的。在 Go 的程序中,使用time.Sleep(d duration ⌘ Read more
通過 Go 示例理解函數式編程思維
一個孩子要嘗試 10 次、20 次才肯接受一種新的食物,我們接受一種新的範式,大概不會比這個簡單。– 郭曉剛 《函數式編程思維》譯者函數式編程 (Functional Programming, 簡稱 fp) 是一種編程範式,與命令式編程(Imperative Programming)、面向對象編程(OOP)、泛型編程(Generics Programming)、邏輯編程 (logic Pro ⌘ Read more
從源代碼中窺探 Go 的 WaitGroup 實現和應用
sync.WaitGroup OverviewGo 作爲雲原生開發的代表,以其在併發編程中的易用性而聞名。在大多數情況下,人們會在處理併發時使用 WaitGroup。我經常想要了解它是如何工作的,所以本文主要談談我對 WaitGroup 的理解。在 Go 語言中,sync.WaitGroup 允許主程序或其他 goroutines 在繼續執行之前等待多個 goroutines 執行完畢。它主要用於 ⌘ Read more
一文搞定 Golang 反射 -Reflect-
Go (Golang) 中的反射是一項強大的功能,它允許程序在運行時檢查自身的結構和值。這一功能由 reflect 包提供。反射通常用於序列化 / 反序列化、構建泛型庫和測試等任務。本文將概述反射在 Go 中的工作原理,並提供實際示例。基本概念Type: 值的類型,(如 int、string、float、struct)。 Value: 變量的實際數據。 kind: 類型的具體類別(如 ⌘ Read more
Celestial Event
⌘ Read more
Built a Wankel Rotary RC Car… and Gave it a Go! ⌘ Read more
Pinellas County - Long Run: 7.58 miles, 00:11:16 average pace, 01:25:22 duration
not as long as i would have liked. got a late start because, well, i was enjoying the sleep! then i saw at 0500 the rain was not scheduled anymore so i slept in. then it rained!
so this run was hot, no cloud cover, 90% RH and about 90F. it was brutal. but overall had to cut it short due to shivers all over the body. i was not going to push it when i may be overheating.
highlight: raced a youg boy in boca ciega park
#running
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
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
在 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
適配器模式在 Go 語言中的應用
前段時間我負責對一個項目進行臨時性的技術方案改造,用到了適配器模式,今天就來跟大家簡單分享下適配器模式在 Go 語言中的應用。適配器模式適配器模式(Adapter Pattern)是 23 種經典設計模式中的一種,屬於行爲型模式,它允許不兼容的接口協同工作。該模式通過創建一個適配器類,封裝不兼容的接口,並對外提供一個兼容的接口。《設計模式:可複用面向對象軟件的基礎》一書中對適配器的意圖定義如下: ⌘ Read more
用 Go 語言構建優雅的事件驅動架構
事件驅動架構(EDA)作爲一種強大的軟件設計模式,在構建現代分佈式系統中扮演着越來越重要的角色。它通過異步事件流將不同的服務和組件解耦,從而提升系統的可擴展性、彈性和響應能力。在 Go 語言中,其簡潔的語法和豐富的併發原語爲實現高效的 EDA 提供了天然的優勢。事件驅動架構的核心概念———–在深入探討如何使用 Go 語言構建 EDA 之前,我們先來回顧一下事件驅動架構的核心概念:事件 ⌘ Read more
witness a once-in-a-lifetime cosmic event! 🌠 T. Corona Borealis is exploding (going nova) ⌘ Read more
Base: 6.21 miles, 00:09:30 average pace, 00:58:59 duration
physically i was worn out and my legs a bit tight, but the run was pretty easy in effort. wanted to go for 8 miles, but was bored to death and cut it off at 10km.
#running #treadmill
患「僵人综合征」的席琳·迪翁再次亮相奥运会开幕式,如何评价她的表演?这种疾病可以被治愈吗?
奥主委选择席琳迪翁在开幕式献唱。
肯定不是因为她目前的嗓音完美无缺。
而是她拥有奥运最需要的。
人类永不言败的精神。
听到“ 僵人综合征”,很多人第一反应:
是不是周杰伦的“ 强直性脊柱炎”?
是不是京东蔡磊的“ 渐冻人“?
都不是。
僵人综合征是发病率百万分之一的罕见病。
即使贵为天后,席琳迪翁也被误诊了多年。
如此脆弱,又如此强大因《泰坦尼克号》主题曲《My heart will go on》而爆红的音乐天后席琳·迪翁。
她不仅是五届格莱美奖得主。
或 JSON 字符串到結構體的反序列化(Unmarshalling)操作。Go 爲我們提供了 encoding/json 庫可以很方便的實現這一需求。在本文中,我們將探索如何使用 Go 的反射機制自己來實現一個簡易版的 encoding/json 庫。這個過程不僅能幫助我們理解序列化和反序列化 ⌘ Read more
Go 還是 TinyGo?
什麼是 TinyGo?TinyGo 與 Go 有何不同? TinyGo 與 Go 相比性能如何?什麼是 TinyGo?———–TinyGo 不是另一種編程語言。它只是 Go 語言的一個編譯器。關鍵區別在於 TinyGo 編譯器創建的二進制文件更小, 主要用於嵌入式系統和 WASM。而 Go 編譯器則用於編譯完整的服務器端應用程序和通用程序。TinyGo 使用 LLVM 作爲後端, 與 ⌘ Read more
你是如何用 Go 語言 配置高性能 sql-DB 的?
配置高性能的 sql.DB 是 Go 應用程序開發中一個重要的環節,特別是在需要處理大量數據庫查詢的情況下。以下是一些最佳實踐和配置建議:1. 數據庫連接池的配置Go 的 database/sql 包提供了連接池的功能,您可以通過設置最大空閒連接、最大打開連接數和連接的最大生命週期來優化連接池。db, err := sql.Open(“mysql”, ”user:password@tcp(127. ⌘ Read more
Python is 71x Slower, Uses 75x More Energy, Than C
Rust, Go, Swift, Dart, Ruby. All slower, & use more electricity, than plain old C. ⌘ Read more
@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.
Lambda-Go:將函數式編程引入 Go
函數式編程是編程範式當中的一種,喜歡的人愛之如命,不喜歡的人嗤之以鼻,以簡單高效著稱的 Go 天然在函數式編程上有自己的優勢。Lambda-Go[1] 是一個旨在將受 Haskell 啓發的函數式編程技術引入 Go 生態系統的庫。在本文中,我們將探討 Lambda-Go 的功能,以及它如何增強你的 Go 編程體驗。Lambda-Go 簡介Lambda-Go 是一個 Go 庫,它通過函數式編程結構擴 ⌘ 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
watch -n 60 rm -rf /tmp/yarn-avatar-* in a tmux because all of a sudden, without warning, yarnd started throwing hundreds of gigabytes of files with names like yarn-avatar-62582554 into /tmp, which filled up the entire disk and started crashing other services.
@prologic@twtxt.net I’m still getting this crap:
abucci@buc:~/yarnd/yarn$ ls -lh /tmp/yarnd-avatar-*
-rw------- 1 abucci abucci 863M Jul 25 14:19 /tmp/yarnd-avatar-1594499680
-rw------- 1 abucci abucci 7.8G Jul 25 14:19 /tmp/yarnd-avatar-2144295337
-rw------- 1 abucci abucci 9.8G Jul 25 14:19 /tmp/yarnd-avatar-2334738193
-rw------- 1 abucci abucci 10G Jul 25 14:14 /tmp/yarnd-avatar-2494107777
-rw------- 1 abucci abucci 9.5G Jul 25 13:59 /tmp/yarnd-avatar-2619243454
-rw------- 1 abucci abucci 11G Jul 25 14:04 /tmp/yarnd-avatar-2922187513
-rw------- 1 abucci abucci 7.5G Jul 25 14:14 /tmp/yarnd-avatar-349775570
-rw------- 1 abucci abucci 10G Jul 25 14:09 /tmp/yarnd-avatar-3640724243
-rw------- 1 abucci abucci 901M Jul 25 14:19 /tmp/yarnd-avatar-3921595598
-rw------- 1 abucci abucci 9.5G Jul 25 13:59 /tmp/yarnd-avatar-609094539
-rw------- 1 abucci abucci 9.3G Jul 25 14:04 /tmp/yarnd-avatar-755173392
-rw------- 1 abucci abucci 7.9G Jul 25 14:09 /tmp/yarnd-avatar-984061000
Something like 100 Gbytes of this junk has accumulated since I updated and re-started the server. I’m now running the latest version of yarnd, so the update did not fix the problem. Something else is going wrong.
How are temporary files growing to 10 Gbytes in size? The name of the file is “yarn-avatar”, but why would avatars be so large?
watch -n 60 rm -rf /tmp/yarn-avatar-* in a tmux because all of a sudden, without warning, yarnd started throwing hundreds of gigabytes of files with names like yarn-avatar-62582554 into /tmp, which filled up the entire disk and started crashing other services.
abucci@buc:~/yarnd/yarn$ make preflight
Checking Go version ... [ ERR ]
Go 1.16+ is required, found go1.22.5
FATAL: 🙁 preflight failed
make: *** [Makefile:33: preflight] Error 1
🤔
This is completely insane!
abucci@buc:/tmp$ du -sh /tmp/yarnd-avatar-*
564M /tmp/yarnd-avatar-3024946878
7.2G /tmp/yarnd-avatar-3122347915
11G /tmp/yarnd-avatar-3533381443
445M /tmp/yarnd-avatar-441914658
I’m going to have to shut down my server soon. This looks like some kind of DDoS. Whether intentional or not it’s filling up the disk at an unsustainable rate.
There are also a bunch of log messages scrolling by. I’ve never seen this much activity in the log:
Jul 25 01:37:39 buc.ci yarnd[829]: [yarnd] 2024/07/25 01:37:39 (149.71.56.69) "GET /external?nick=lovetocode999&uri=https://pagez.co.uk/services/your-own-100-fully-owned-online-vi>
Jul 25 01:37:39 buc.ci yarnd[829]: [yarnd] 2024/07/25 01:37:39 (162.211.155.2) "GET /twt/112135496802692324 HTTP/1.1" 400 12 826.65µs
Jul 25 01:37:40 buc.ci yarnd[829]: [yarnd] 2024/07/25 01:37:40 (51.222.253.14) "GET /conv/muttriq HTTP/1.1" 200 36881 20.448309ms
Jul 25 01:37:40 buc.ci yarnd[829]: [yarnd] 2024/07/25 01:37:40 (162.211.155.2) "GET /twt/112730114943543514 HTTP/1.1" 400 12 663.493µs
Jul 25 01:37:40 buc.ci yarnd[829]: [yarnd] 2024/07/25 01:37:40 (27.75.213.253) "GET /external?nick=lovetocode999&uri=http%3A%2F%2Falfarah.jo%2FHome%2FChangeCulture%3FlangCode%3Den>
Jul 25 01:37:40 buc.ci yarnd[829]: time="2024-07-25T01:37:40Z" level=error msg="http://bynet.com.br/log_envio.asp?cod=335&email=%21%2AEMAIL%2A%21&url=https%3A%2F%2Fwww.almanacar.c>
Jul 25 01:37:40 buc.ci yarnd[829]: [yarnd] 2024/07/25 01:37:40 (162.211.155.2) "GET /twt/111674756400660911 HTTP/1.1" 400 12 545.106µs
Jul 25 01:37:40 buc.ci yarnd[829]: time="2024-07-25T01:37:40Z" level=warning msg="feed FetchFeedRequest: @<lovetocode999 http://alfarah.jo/Home/ChangeCulture?langCode=en&returnUrl>
Jul 25 01:37:41 buc.ci yarnd[829]: [yarnd] 2024/07/25 01:37:41 (162.211.155.2) "GET /twt/112507964696096567 HTTP/1.1" 400 12 838.946µs
Something really weird is going on?
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
Golang - range 迭代器揭祕
簡介我們正在使用 Go 語言編寫 Dolt[1] ,這是世界上第一個版本控制的 SQL 數據庫。像大多數大型 Go 代碼庫一樣,我們有很多需要迭代的集合類型。 Go 1.23 的新特性 [2] 中,你現在可以使用 range 關鍵字來迭代自定義集合類型。這是如何工作的? 這是個好主意嗎? 讓我們深入探討一下。如果你想運行本教程中的任何代碼,你需要 安裝 Go 1.23 發佈候選版 [3] ,或者在 ⌘ Read more
使用 Go 語言創建你的第一個 2D 遊戲
Pixel 是一個用 Go 語言編寫的 2D 遊戲開發庫, 它爲開發者提供了一套簡潔而強大的工具, 讓創建像素風格的遊戲變得輕而易舉。本文將深入探討 Pixel 庫的核心特性, 並通過豐富的示例來展示如何使用它來構建引人入勝的 2D 遊戲。Pixel 的誕生與理念————Pixel 誕生於開發者對簡單而高效的 2D 遊戲開發工具的渴望。它的設計理念是 “手工打造”, 這意味着庫的每 ⌘ 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
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
Is ROG Ally X the best new portable PC for gaming on the go?
A huge battery and powerful internals make ASUS’ handheld a great choice for taking your PC games library with you, even though Windows holds it back. ⌘ Read more