13

第4期 Windows11来了 (一周阅读与记录)

 2 years ago
source link: https://sikasjc.github.io/2021/07/03/004/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

第4期 Windows11来了 (一周阅读与记录)

2021年7月3日

距离上次更新以及过去很久了,幸好这周更新了,哈哈~

Windows 11 发布,支持原生 Android 应用

tweet

阮一峰的博客中认为

… App 开发将从多端并存,进入全端时代 …

我自己想了想,微软会不会借此机会,通过Windows 11重回手机市场

The complete guide to Go net/http timeouts

  • 详尽地介绍了golang net/http库中的各种超时
  • server
    server
  • client
    client

Reducing Memory Allocations in Golang

  • 使用 profiling 工具定位代码性能瓶颈点
  • 应该尽量避免[]byte和string的相互转换。因为Go中的string是不可变的类型,[]byte和string相互转换在标准库中是会产生复制与分配的。
    • 可以使用unsafe进行 string 与 []byte 之间的转换,而没有分配
      • string -> []byte: ([]byte)(unsafe.Pointer(&s))
        • 转换后的[]byte不能修改,否则会panic
      • []byte -> string: *(*string)(unsafe.Pointer(&buf))
        • 修改[]byte,会导致转换后的string内容改变
  • 如果不依赖于循环中更新的状态,则不要在循环中存在产生分配的代码
  • 当遇到存在非常多的分配时,使用sync.Pool 池化
  • 尽可能复用buffer
    • bytes.Buffer.Reset()
    • buf = buf[:0]
  • 使用benchmark确定是否有改善以及改善程度

State Machine Design pattern —Part 1: When, Why & How

  • 在写文本、协议的parser还有涉及很多其他领域时,状态机能提供强大的抽象,极大的减轻编程时的复杂度。

状态机方法

  • 对于一个准备实施的状态机,我们需要检查:
    • 图上表达了系统可能收到的所有事件吗?
    • 我们推演了每个节点上可能收到的所有事件的处理吗?
    • 我们有可能陷入某种状态而无法离开吗?
    • 状态机可以化简吗?

Please, don’t use equality operator when comparing password hashes

A timing attack is a side-channel attack in which the attacker attempts to compromise a cryptosystem by analyzing the time taken to execute cryptographic algorithms.

  • 密码等关键信息的字符串比较,需要比较完全部的字符串。

如果从第一位开始比较,发现不同就立即返回,那么通过计算返回的速度就知道了大概是哪一位开始不同的


Linux 30年专访:Linus Torvalds谈Linux内核开发与Git

30 年前,当 Linus Torvalds 第一次发布 Linux 内核时,他还是赫尔辛基大学的一名 21 岁的学生。他宣布说:“我正在开发一个(免费的)操作系统(这只是个爱好,不会做得很大,也不会很专业……)”。30 年后,500 强超级计算机和 70%以上的智能手机都在运行 Linux。很显然,Linux 不仅大,而且很专业。

Bash-Oneliner

A collection of handy Bash One-Liners and terminal tricks for data processing and Linux system maintenance.


Impossible World

不可能图形——几何与视觉的魔术

很多看起来很合理但是现实中不可能存在的图像

「纪念碑谷」系列被广大玩家奉为神作的重要原因,在于其极尽艺术美感的画面构图和极富空间想象力的精巧谜题。狭长环廊和高尖建筑在玩家指尖辗转挪移,为玩家呈现出一场几何艺术的视觉盛宴。无论是构图还是谜题,其背后都有着同一理论做支撑——不可能图形。

所见皆实,所见皆虚


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK