Changkun's Blog

Science and art, life in between.


  • Home

  • Ideas

  • Archives

  • Tags

  • Bio

2020 读书清单

Published at: 2020-12-25   |   Reading: 1278 words ~3min

又到年末了,是时候整理一波今年的读书清单了。2020 年实在是太特殊了,这一年里读过的书其实也不多, 大多与专业相关,且好几本是本科时期读过再来重读的,这类书过于经典,每次读的收获都会有所不同。

Read More »

The All in Go Stack

Published at: 2020-12-24   |   Reading: 7474 words ~15min

本科毕业以后就很少有时间来折腾自己的网站了,大部分时间里都是 ssh 到服务器上随便搭 好一个服务后就任其自由生长,即便是服务挂掉了之后也没有太在意——毕竟是自己用的东西, 对于网站的用户而言:ABSOLUTELY NO WARRANTY。不过随着网站近来的用户数量呈现难以置信 的增长势头(虽然什么也没干),自然也就难免希望让网站变得更加「可靠」。

作为 2020 年的最后几项 TODO,我终于在圣诞节休假的第一周的前三天完成了整个 changkun.de 的「架构升级」,从原来组织混乱、 依赖复杂的 Native Nginx + Docker + tmux served binary + Jupyter notebook + hypervisor + crontab + … 等等依赖 C/C++/Python/Node.js/Go/… 以及数不胜数的第三方依赖全面转向了以「尽可能自研、能不依赖就不依赖、 即使以来也要依赖使用 Go 开发的依赖」为指导思想的纯 Go 的后端结构。

这篇文章就介绍了 changkun.de 作为个人网站, 从最初的每年不到一百的活跃用户到现在的每月上万活跃用户这个过程中 究竟积累并承载了哪些(公开的、但不那么可见的)个人以及面向公共的服务,以及它背后的迁移故事。

Read More »

Pointers Might Not Be Ideal for Parameters

Published at: 2020-11-05   |   Reading: 1814 words ~9min

We are aware that using pointers for passing parameters can avoid data copy, which will benefit the performance. Nevertheless, there are always some edge cases we might need concern.

Let’s take this as an example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
// vec.go
type vec struct {
	x, y, z, w float64
}

func (v vec) addv(u vec) vec {
	return vec{v.x + u.x, v.y + u.y, v.z + u.z, v.w + u.w}
}

func (v *vec) addp(u *vec) *vec {
	v.x, v.y, v.z, v.w = v.x+u.x, v.y+u.y, v.z+u.z, v.w+u.w
	return v
}

Which vector addition runs faster?

Read More »

Eliminating A Source of Measurement Errors in Benchmarks

Published at: 2020-09-30   |   Reading: 1711 words ~9min
About six months ago, I did a presentation that talks about how to conduct reliable benchmarking in Go. Recently, I submitted an issue #41641 to the Go project, which is also a subtle problem that you might need to address in some cases. The issue is all about the following code snippet: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 func BenchmarkAtomic(b *testing.
Read More »

Setup Wordpress in 10 Minutes

Published at: 2020-03-29   |   Reading: 465 words ~3min
Last week, my colleague asked me to set up a Wordpress server, and I remember how painful to setup it many years ago. It requires MySQL and PHP. Therefore, it may introduce many security leaks. My website at the moment still can receive Wordpress attack. Today, I discovered a rapid solution to set up a Wordpress server using Docker, and it also solves the problem with Let’s Encrypt. Let’s check it out.
Read More »
1 2 3 4 5 6 7 8
Changkun Ou

Changkun Ou

Stop Talking. Just Coding.

274 Blogs
165 Tags
RSS
Homepage GitHub Email YouTube Twitter Zhihu
Friends
    Frimin ZZZero march1993 qcrao maiyang Xargin Muniao
© 2008 - 2022 Changkun Ou. All rights reserved. | PV/UV: /
0%