不要比较

给自己灌点鸡汤,大家共勉! 献给23届求学找工的同学–“Don’t Compare(不要比较)” from CS61A Fall 2019 Lecture 39 Video 4 Original English Version Short notes Freedom Think about what is worth working on, since you only have so much time. Do something matters to both the world and you) Fulfilling work work on something you are good at you like what you are working on useful to the world in some way You can take some time to find it, just keep looking around Power Don’t screw it up, we are building the world Create a world that lots of people can contribute to it The world we have today is due to contributions of millions of people who all did their part Self-Worth Don’t compare Out there in real life, how you compare to somebody else doesn’t matter much at all What does matter is what you are capable of, what you do, how you choose to spend your time, and what impact you have on the world. It turns out your self-worth has nothing to do with what other people achieve, it has everything to do with what you achieve I hope it sticks with you, and it’s not a good idea to spend your time comparing yourself to other people, and just focusing on improving yourself. ...

March 23, 2025 · 1 min · ChaosNyaruko

Disclaimer The original post was written by Andrew Gerrand on 13 July, 2010. I’m reposting it not because it’s “absolutely” correct, it just offers another perspective of concurrent programming, and in SOME case, it might be more suitable than “sharing memory” or “mutex stuff”. It may also help you appreciate some design philosophy of Go, and provide you with some inspiration when dealing with concurrency or other problems. Again I’m not saying it’s BETTER, it’s just another another way of thinking and designing. ...

August 30, 2024 · 5 min · ChaosNyaruko

How to measure execution time of function in golang, excluding waiting time

Two ways from StackOverflow Builtin Way Using “syscall” func GetCPU() int64 { usage := new(syscall.Rusage) syscall.Getrusage(syscall.RUSAGE_SELF, usage) return usage.Utime.Nano() + usage.Stime.Nano() } Explanation Utime: user CPU time Stime: system CPU time RUSAGE_SELF: means it’s measuring the “calling” process man 2 getrusage for more information NOTE: The documentation for syscall.Timeval suggests that Nano() returns the time in nanoseconds since the Unix epoch, but in my tests and looking at the implementation it appears actually to return just the CPU time in nanoseconds, not in nanoseconds since the Unix epoch. ...

August 30, 2024 · 2 min · ChaosNyaruko

模糊搜索工具FZF的介绍与个人实践

前言 本文是什么 终端工具FZF的简单介绍和入门 「个人」对此工具的使用和实践,尤其是一些扩展使用方式 【矫情】由小及大,怎么联想到一些其他的东西的 本文不是什么 不是“最佳实践” 「最佳实践」是指在特定领域内经过实践检验并证明具有卓越效果的技术、方法、流程、活动或机制。它们之所以被称为「最佳」,是因为这些实践能够在提高效率、降低成本、提升质量、确保安全、增强客户满意度等方面展现出超越平均水平或现有做法的优势。 这篇文章显然配不上这个称谓 不是系统性的使用教程,更不是使用手册 RTFM 😊 Wiki FZF是什么 基于终端和命令行的工具(CLI) 提供「模糊」搜索的功能(Fuzzy Search) 提供一个简单但直观的TUI (Integrated with Other Tools) 基础用法 查找文件:直接使用 你可以直接在命令行下面输入对应的命令,-m表示多选,默认行为是列出当前文件夹下的所有文件,选中后按回车会把路径/文件名显示在命令行上 fzf fzf -m vim $(fzf -m) 还可以通过环境变量配置预览效果、窗口大小、快捷键等。 因为是环境变量,所以如果在Shell配置文件里将其export,让它被子进程继承,那么所有的相关配置无需重复配置,便可以在子进程(例如Vim中)生效,后面将在Vim集成章节中稍稍展示一下。 典型例子如下(具体含义请参见官方文档): FZF_DEFAULT_COMMAND FZF_DEFAULT_OPTS FZF_DEFAULT_OPTS_FILE 简单语法 fzf支持一套语法(丐版正则),让你能在fuzzy的过程中,还是有一定的搜索效率,以下仅列出部分,更多请参考官方文档 Token Match type Description sbtrkt fuzzy-match Items that match sbtrkt 'wild exact-match (quoted) Items that include wild ^music prefix-exact-match Items that start with music .mp3$ suffix-exact-match Items that end with .mp3 !fire inverse-exact-match Items that do not include fire !^music inverse-prefix-exact-match Items that do not start with music !.mp3$ inverse-suffix-exact-match Items that do not end with .mp3 与Shell集成 查看Shell命令历史 使用快捷键Ctrl+R查看Shell命令历史,如果你使用的是原始的bash或者zsh的话,基本可以替换原来的功能,使用起来友好得多;如果你和我一样,主要使用fish,那可能不一定用得上,但我由于个人使用习惯,目前仍然在使用fzf的这个功能,而不是fish自带的那个也蛮好用的历史记录。 ...

July 27, 2024 · 2 min · ChaosNyaruko

Lisp之根源

The ORIGINAL post Abstract 约翰麦卡锡于1960年发表了一篇非凡的论文,他在这篇论文中对编程的贡献有如 欧几里德对几何的贡献.1 他向我们展示了,在只给定几个简单的操作符和一个 表示函数的记号的基础上, 如何构造出一个完整的编程语言. 麦卡锡称这种语 言为Lisp, 意为List Processing, 因为他的主要思想之一是用一种简单的数据 结构表(list)来代表代码和数据. 值得注意的是,麦卡锡所作的发现,不仅是计算机史上划时代的大事, 而且是一种 在我们这个时代编程越来越趋向的模式.我认为目前为止只有两种真正干净利落, 始终如一的编程模式:C语言模式和Lisp语言模式.此二者就象两座高地, 在它们 中间是尤如沼泽的低地.随着计算机变得越来越强大,新开发的语言一直在坚定地 趋向于Lisp模式. 二十年来,开发新编程语言的一个流行的秘决是,取C语言的计 算模式,逐渐地往上加Lisp模式的特性,例如运行时类型和无用单元收集. 在这篇文章中我尽可能用最简单的术语来解释约翰麦卡锡所做的发现. 关键是我 们不仅要学习某个人四十年前得出的有趣理论结果, 而且展示编程语言的发展方 向. Lisp的不同寻常之处–也就是它优质的定义–是它能够自己来编写自己. 为了理解约翰麦卡锡所表述的这个特点,我们将追溯他的步伐,并将他的数学标记 转换成能够运行的Common Lisp代码. Addendum Paul Graham原文

June 21, 2024 · 1 min · ChaosNyaruko