米米的博客

做了一点微小的工作

安装 Certbot

Certbot 是用来申请 SSL 证书的。Certbot 的安装方式有几种,具体可以在Certbot 官网上查询。
笔者尝试了通过pip进行安装,直接执行pip install certbot即可安装好 Certbot。

安装完成后,可以使用

1
sudo certbot -h

查看安装是否成功。如果报错,也可以尝试使用其它安装方式。
如果你使用了 Nginx 服务器,还可以执行

1
yum install certbot-nginx

安装 Certbot 的 Nginx 拓展。

配置 Certbot

执行

1
sudo certbot --nginx

即可自动完成配置。不过由于涉及到修改 nginx.conf,建议手动进行配置:

1
sudo certbot certonly --webroot -w /path/to/your/webroot -d example.com,www.example.com

/path/to/your/webroot替换为 nginx 的根目录,example.com替换为你的域名,多个域名用逗号隔开,不支持通配符。

如果一切顺利,会输出以下内容:

1
2
3
4
5
6
7
8
9
10
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at
/etc/letsencrypt/live/example.com/fullchain.pem. Your cert
will expire on 20XX-XX-XX. To obtain a new or tweaked version of
this certificate in the future, simply run certbot again. To
non-interactively renew *all* of your certificates, run "certbot
renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le

生成的证书将会存放在/etc/letsencrypt/live/目录下。

阅读全文 »

Linux is fun! Huhhh. OK so you don't believe me. Mind me at the end of this article you will have to believe that Linux is actually a fun box.
Linux 是非常有趣的,别不相信 —— 看完这篇文章,你一定会发现 Linux 系统神奇的用法。
请注意,下面部分命令给出了两种包管理软件的安装方式,如果是 Debian 系的系统,请使用apt,如果是 Red Hat 系的系统,请使用yum。如果你使用了其他 Linux 发行版,或使用了其他包管理工具(例如 macOS 上的 brew),可能无法找到所有这些命令。
注:为了在代码块中区别输入输出,以$开头的行代表输入,其它行代表输出。

curl

命令:curl
curl 用于互联网传输数据,支持多种协议。通过以下命令可以查看天气:

1
$ curl -4 http://wttr.in

sl (Steam Locomotive)

命令:sl(蒸汽机车的缩写)
You might be aware of command 'ls' the list command and use it frequently to view the contents of a folder but because of miss-typing sometimes you would result in 'sl', how about getting a little fun in terminal and not command not found.
你一定知道 ls 是用来显示文件夹内容的常见命令,但如果不小心打成 sl 呢?通过包管理工具安装它,你就能看见一辆跑过屏幕的火车,而不是「找不到命令」:

1
2
3
$ apt install sl #In Debian like OS, or aptitude based system
$ yum install sl #In Red Hat like OS, or yum based system
$ sl

This command works even when you type 'LS' and not 'ls'.

telnet

命令:telnet
No! No!! it is not as much complex as it seems. You would be familiar with telnet. Telnet is a text-oriented bidirectional network protocol over network. Here is nothing to be installed. What you should have is a Linux box and a working Internet.
不!它并不像看上去那样复杂。你会熟悉它的。Telnet 是一个基于文本的双向网络协议。你无需安装它,只需要一台能够联网的 Linux 机器就行。
输入以下命令即可观看 ASCII 版星球大战:

1
$ telnet towel.blinkenlights.nl

而以下命令将会在你的命令行中生成一个 ASCII 世界地图:

1
$ telnet mapscii.me

是不是很有趣?

fortune

命令:fortune What about getting your random fortune, sometimes funny in
terminal.
在终端获取随机的人生经验,听上去不错吧?

1
2
3
4
5
6
7
8
$ apt install fortune
$ yum install fortune
$ fortune

You're not my type. For that matter, you're not even my species!!!
Future looks spotty. You will spill soup in late evening.
You worry too much about your job. Stop it. You are not paid enough to worry.
Your love life will be... interesting.
阅读全文 »

借助这个项目,你可以在 GitHub 热点图(动态图)上绘制图案,并由此生成 Shell 脚本;在空项目中执行该脚本,便能创造过去的 commit 记录;而将该项目 push 到 GitHub 上,你的热点图就变得和绘制的图案完全相同。

Git Draw

项目地址:git-draw
原项目是一个 Chrome 插件,由于长期没有维护,且 GitHub 改变了页面结构,导致插件不可用。新项目重写了部分 JavaScript 代码,使得其能够正常运行。快来试试吧!

2018 年 CUPT 的第一题:

Invent Yourself
Construct a simple seismograph that amplifies a local disturbance by mechanical, optical or electrical methods. Determine the typical response curve of your device and investigate the parameters of the damping constant. What is the maximum amplification that you can achieve?
自主发明
建造一个可以通过力学、光学或电学方法放大局部扰动的简单地震仪。确定你装置的标准响应曲线并且研究阻尼常数的参量。你能达到的最大放大率是多少?

此题的关键便是将地震仪的反应谱通过可观测量进行表示。实现的思路有很多,力学、光学或电学方法都是可行的。综合考虑了实现难度和测量精度后,决定采用以下方案:通过力学方法放大震动,然后利用霍尔片和磁铁将力学量转换为电学量,借助 Arduino 单片机的模数转换,通过串口将信号输入到电脑,电脑用 Python 监听串口,将获得的数据保存并实时分析、绘图。

仪器的整体构造如图:

仪器的整体构造

阅读全文 »

1
2
3
4
5
6
7
double world;
unsigned letter;
short stay;
long memories;
long long ago;
float cloud;
printf("I miss you.\n");
1
2
3
4
for (everynight in mydreams) {
i.see(you);
i.feel(you);
}
1
select * from world where someone like '%you%';

Nothing is absolute.

1
2
3
4
5
<style>
* {
position: relative;
}
</style>

物是人非事事休,欲语泪先流。

1
2
3
4
5
6
7
if (item && !people) everything = false;
if (tears.setFlowing()) try {
Speaker skr = new Speaker();
}
catch {
IOException e;
} ()

先天下之忧而忧,后天下之乐而乐。

1
2
3
4
5
6
if (others.rejoice() == true) {
self.rejoice();
}
else {
self.worry();
}
阅读全文 »
0%