使用 Yield 实现 Python 协程

考虑如下代码: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 def async_call(it, ret_list=None): try: value = ret_list[0] if ret_list and len(ret_list) == 1 else ret_list

A point of python metaclass

Create class dynamically Python doc says: By default, classes are constructed using type(). The class body is executed in a new namespace and the class name is bound locally to the result of type(name, bases, namespace). That’s means, a class statement is equivalent to the call of type method with three arguments: name: name of the class bases: tuple of the parent class (for inheritance, can be empty) attrs: dictionary

V3Ray 的配置笔记

学生时代曾为整个课题组的师生搭建过一个梯子,稳定运行两年多,最近突然爬不上去了。 寻思是哪里出了问题,经过一番定位,原来是之前的免费域名到期了

Python Iterables

Python 的迭代器(iterator)、生成器(generator)、可迭代对象(iterable),虽是老生常谈,但我毕竟要记录一下自己的见解,因

Linux 的休眠

先区分一下两个名词:睡眠(sleep)和休眠(hibernate)。

  • 睡眠:将工作镜像写入内存(RAM),以便快速恢复。内存读写很快,所以睡眠的特点就是“睡得快”和“醒得快”。对于笔记本来说,合上盖子就睡了,打开盖子你的工作区间即刻就能恢复,很是方便。但是睡眠有一个缺点,就是要给内存供电,一旦断电,你的镜像数据就会丢失,工作区间将不复存在。当然这来自于内存的固有特点,建议百度 RAM。
  • 休眠:将工作镜像写入硬盘(disk,ROM),这样你也可以恢复工作区间。只是睡下去和醒过来的时间比内存慢不少。但是,它有一个好处就是断电了也不会丢失数据。当你再次开机,系统就会从硬盘里面读取镜像,恢复你的工作区间。

Latexmk 基础用法

怎么想到用 latexmk 的呢?写论文呗! 本来呢,我一直习惯于使用命令行手敲 1 pdflatex someting.tex 千万别小看这种重复劳动,它不仅帮你加深记忆,还有最完整的输出,让你一窥 Tex

Gnome 应用启动缓慢

先看环境: $ neofetch -` yychi@MiBook-Air .o+` ---------------- `ooo/ OS: Arch Linux x86_64 `+oooo: Host: TM1604 XMAKB3M0P0202 `+oooooo: Kernel: 5.5.13-arch2-1 -+oooooo+: Uptime: 5 mins `/:-:++oooo+: Packages: 1153 (pacman) `/++++/+++++++: Shell: zsh 5.8 `/++++++++++++++: Resolution: 1920x1080 `/+++ooooooooooooo/` WM: i3 ./ooosssso++osssssso+` Theme: Adwaita [GTK2] .oossssso-````/ossssss+` Icons: Adwaita [GTK2] -osssssso. :ssssssso. Terminal: urxvt :osssssss/ osssso+++. Terminal Font: DejaVu Sans Mono for Powerline /ossssssss/ +ssssooo/- CPU: Intel i5-7200U (4) @ 3.100GHz