由于疫情原因,需要远程在家学习。向日葵这种远程软件总是有延迟,卡卡的。于是爱折腾的我就想起了开源的内网穿透工具 frp
使用内网穿透工具需要一台速度不错的服务器,如果需要买一个云服务器,那我还不如直接开向日葵的会员呢。
但事情巧就巧在我家的网络恰巧又有公网 IP ,于是我就在我自己的电脑上部署了 frps 的服务。
在实验室的电脑里启动 frpc 的客户端,于是就可以通过 3389 端口远程桌面登录了。速度是真的很快。

在我以往的观念里一直都觉得黑客是不会攻击个人电脑的,因为没有勒索的价值。但这次黑客给我上了一课。

有一天我打开电脑,所有的文件都变成这样了。

Due to the pandemic, I needed to study remotely from home. Remote software like Sunlogin always has latency and is laggy. So as someone who loves tinkering, I thought of the open-source intranet penetration tool frp.

Using an intranet penetration tool requires a server with decent speed. If I had to buy a cloud server, I might as well just get a Sunlogin membership.

But as luck would have it, my home network happened to have a public IP, so I deployed the frps service on my own computer.

I started the frpc client on the lab computer, and I could log in via remote desktop through port 3389. It was really fast.

In my past belief, I always thought hackers wouldn’t attack personal computers because there’s no ransom value. But this time, the hackers taught me a lesson.

One day I turned on my computer and all my files had turned into this.

结绳记事

大概半年之前发现了家里的网络具有公网IP,于是就有了在家里部署一台服务器的想法。
最近由于学校还没有开学,只能居家“学习”,又正好之前自己淘汰了一个笔记本电脑,于是立马把笔记本重装成了 Ubuntu22,又在路由器上设置内网的固定IP,设置DMZ主机为我的笔记本电脑。这样,我在笔记本上部署的所有服务就都可以在公网访问了。
但是,由于家里的公网IP是动态的,不是固定的,每次光猫或者路由器断电,重新拨号就会导致IP变更,即使你能保证家里的路由器和光猫不重启,运营商也会每隔一段时间刷新一次的。所以为了能让域名动态的解析到家里的笔记本电脑。就需要DDNS服务了,即动态域名解析。
我的性格自然不会去买花钱的服务的😏,于是想到了利用 DNS 服务商提供的 API 去设置域名解析,在本地设置好定时任务,就可以实现动态域名解析了。
由于 Cloudflare 已经不再对 freenom 上的免费域名提供 API 支持了,所以我这里使用阿里云的 DNS API。
再设置一个企业微信的推送。就完美了✨

About half a year ago I discovered that my home network has a public IP, so I got the idea of deploying a server at home.
Recently, since school hasn’t started yet, I could only study at home. It just so happened that I had retired an old laptop, so I immediately reinstalled Ubuntu22 on it, set a fixed internal IP on the router, and set the DMZ host to my laptop. In this way, all the services deployed on my laptop can be accessed from the public network.
However, since the public IP at home is dynamic, not fixed, every time the optical modem or router loses power and redials, the IP changes. Even if you can guarantee that your router and optical modem never restart, the ISP will still refresh it every once in a while. So in order to dynamically resolve the domain name to my home laptop, I needed a DDNS service — dynamic domain name resolution.
Given my personality, I naturally wouldn’t buy a paid service 😏, so I thought of using the API provided by the DNS provider to set up domain resolution, and set up a scheduled task locally — that way I could achieve dynamic domain name resolution.
Since Cloudflare no longer provides API support for free domains on freenom, I used Alibaba Cloud’s DNS API here.
Plus a WeCom (WeChat Work) push notification. Perfect ✨

WikiPython

什么是 Big Five ?
Big Five 是指 C++ 中一个类的五个核心函数,在 C++ 11 之前还是 Big Three, C++ 11 引入了移动语义,三大核心函数变为了五大核心函数。
这五个核心函数分别是:

  1. 构造函数
  2. 拷贝构造函数
  3. 拷贝赋值函数
  4. 移动构造函数
  5. 移动赋值函数

What is the Big Five?
Big Five refers to the five core functions of a class in C++. Before C++ 11, it was the Big Three; C++ 11 introduced move semantics, turning the three core functions into five.
The five core functions are:

  1. Constructor
  2. Copy constructor
  3. Copy assignment operator
  4. Move constructor
  5. Move assignment operator
C/C++Wiki

C++ 中的结构体对 C 语言的结构体进行了武装,和类几乎没有什么区别,唯一区别在于C++中结构体内成员默认访问属性是 public 的,而 class 中的成员默认访问权限是 private 的。

那么要如何才能在 C 语言的结构体中定义私有成员呢?

直接看代码吧。

In C++, structs have been fortified compared with their C counterparts, and are almost no different from classes. The only difference is that members inside a C++ struct are public by default, while members of a class are private by default.

So how can we define private members in a C struct?

Let’s just look at the code.

C/C++Wiki

题目说的不对,准确的说这个图叫概率密度分布。
输入一组数据,画出这组数据的概率密度函数曲线。
在图像处理中,可以用来表现像素的分布情况,与直方图功能类似。

The title is not quite right — to be precise, this plot is called a probability density distribution.
Given a set of data, plot the probability density function curve of the data.
In image processing, it can be used to show the distribution of pixels, similar in function to a histogram.

WikiMatlab

摸鱼时光发现了一篇折腾 VPS 的博客,上面写着用 nginx 反代 GitHub,可以用于 GitHub 的下载加速,并且说理论上可以做任何网站的镜像。于是我也简单操作了一下。

直接看他的吧

During my idle time I found a blog post about tinkering with VPS. It described using nginx to reverse-proxy GitHub to speed up downloads from GitHub, and claimed that in theory you could mirror any website. So I went ahead and gave it a simple try.

Go read his post directly

Wiki教程分享VPS