(本教程的 Git 仓库:RainEggplant/vscode-verilog-integration)
本教程会介绍如何使用 VSCode 舒适地开发 Verilog。经过配置之后,你将得到:
- 语法高亮
- 代码检查
- 自动补全
- 自动格式化
- 转到/查看定义
- 文件大纲
- 代码片段
- Git 版本控制
- ...
(本教程的 Git 仓库:RainEggplant/vscode-verilog-integration)
本教程会介绍如何使用 VSCode 舒适地开发 Verilog。经过配置之后,你将得到:
(注:这是我在系科协写的第一篇 Weekly (面向所有同学的介绍类文章), 那就同步到这里来吧~)
请不要着急,在介绍异步编程前,让我们先耐心了解一下下面的几个概念,虽然可能会有些枯燥,但这对后面的学习是非常有必要的。
进程 (process), 是运行中的可执行程序的实例。打开“任务管理器”,你会看到许多进程。如果你切换到“详细信息”选项卡,你还会看到每个进程含有的“线程”数目(如果看不到可以右键列表标题栏,在“选择列”中勾选“线程”)。那么“线程”又是什么呢?
线程 (thread), 是操作系统能够进行运算调度的最小单位。它被包含在进程之中,是进程中的实际运作单位。默认情况,一个进程只包含一个线程,从程序的开始到执行结束。但线程可以派生自其它线程,并且它们共享该进程所拥有的全部资源。所以一个进程可以包含不同状态的多个线程,来执行程序的不同部分,最重要的是,它们是并发执行的。
所以“并发”是什么意思呢?想一想你平常使用电脑的时候,是不是能够一边听音乐一边上网呢?这种看上去像是在同时执行的情形就是所谓的“并发”(之所以说“看上去”是因为大多数情况下各线程所含的指令只是在逻辑上是同时执行的,而在物理上并不是真正地同时执行的(即不是并行的),这涉及到现代操作系统的 CPU 调度机制,有兴趣的同学可以去了解)。
所以说,线程的并发性不仅使得我们能够同时运行不同的程序,还保证了每个程序能够通过多线程同时执行不同的任务,这是十分重要的。
I made a scholarship presentation last evening. There were 17 students presenting for this Comprehensive Scholarship, and I was lucky to be one of them.
However, I hardly thought I could get this opportunity when I clicked the applying button casually serveral days ago. When the counselor told me that I've made it to the presentation stage, I was really surprised.
But after I saw the student list , I realized that I was probably just "lucky" to get this opportunity. It seemed that many top students didn't even submit the application, while I happened to apply (just for fun), so I was involved.
In fact, though my grade was not bad, it's far from excellent. Maybe they chose me because I was versatile. I comforted myself. Such being the case, I started to prepare for the presentation.
I was the third student to make the presentation. After I finished it, I began to listen to other students' presentation. Then I was stunned.
Most of them did not only excel at academics, but also perform well in many other aspects like art, sports and social work. They had an ample amount of experience. I felt ashamed. Then I thought of one of my friend's words—"the gap between people enlarges hugely during college years". I was lost in thought.
I recalled my freshman year. Not so satisfying. No excellent grade, few social activities, poor time management... I was even kind of shiftless.
There definitely needs to be a change.
普通用户使用 Let's Encrypt 证书有 90 天有效期的限制,但通过 Certbot 可以实现证书的自动续期。不过,更新证书后必须重新加载 nginx 配置文件才能生效。遗憾的是,Certbot 的默认定时任务并没有包含重载配置文件的命令。
为了避免未重载配置文件导致的服务不可用,我们需要对 Certbot 任务配置文件做出修改。其位于 /etc/cron.d/certbot
.
默认配置大概是这样:
1 2 3 4 5 6 7 8 9 10 11 |
# /etc/cron.d/certbot: crontab entries for the certbot package # # Upstream recommends attempting renewal twice a day # # Eventually, this will be an opportunity to validate certificates # haven't been revoked, etc. Renewal will only occur if expiration # is within 30 days. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(3600))' && certbot -q renew |
我们只需要将向最后一行命令末尾添加 --renew-hook "/etc/init.d/nginx reload"
即可。即:
1 |
0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(3600))' && certbot -q renew --renew-hook "/etc/init.d/nginx reload" |
--renew-hook
后面的命令会在每次成功续期证书后运行。此处即为重新加载 nginx 配置文件。
参考链接:https://www.guyrutenberg.com/2017/01/01/lets-encrypt-reload-nginx-after-renewing-certificates/
近期评论