跳转至

笔记

VPN

VPN原理

vpn:英文全称是“Virtual Private Network”,翻译过来就是“虚拟专用网络”。vpn通常拿来做2个事情:

  • 一个是可以让世界上任意2台机器进入一个虚拟的局域网中(当然这个局域网的数据通讯是加密的,很安全,用起来和一个家庭局域网没有区别),
  • 一个是可以用来翻墙。

VPN与SS的区别

  • SS全称shadowsocks,SSR全称shadowsocks-R
  • VPN是为了保证通信的安全性、私密性,不是专门为“科学上网”制定的技术
  • 而SS/SSR则是为了转发客户端流量,绕过防火墙的检测,从而达到“科学上网”的真实意图,但是没有保证数据传输的安全性。
  • vpn比ss更加底层,它通过操作系统的接口直接虚拟出一张网卡,后续整个操作系统的网络通讯都将通过这张虚拟的网卡进行收发。
  • 这和任何一个代理的实现思路都差不多,应用层并不知道网卡是虚拟的,这样vpn虚拟网卡将以中间人的身份对数据进行加工,从而实现各种神奇的效果。具体来说,vpn是通过编写一套网卡驱动并注册到操作系统实现的虚拟网卡,这样数据只要经过网卡收发就可以进行拦截处理。

一句话,vpn在IP层工作,而ss在TCP层工作。

内网访问举例

  • 普通用户无法访问公司内网服务器
  • 开启VPN以后,如果他想打开公司ERP,他的电脑就不再直接连接公司ERP网站,而是去连接VPN服务器,并给VPN服务器发一条指令——“我要访问公司ERP”。
  • VPN服务器接到指令后,VPN服务器自己去访问公司ERP,收到公司ERP网页的内容,再把内容回传给员工,这样使用VPN的员工最终就能看到公司ERP网站的内容了。
  • 也就是说,使用VPN时,这个员工的所有网上访问都通过VPN服务器代理完成的。

IP packet 如何被传输

理解 VPN 路由(以及任何网络路由)配置的关键是认识到一个 IP packet 如何被传输,以下描述的是极度简化后的单向传输过程:

  1. 机器 A (192.168.0.2) 发送了一个目标地址为 172.29.1.4 的 IP packet.
  2. 根据本地路由规则,172.29.1.0/24 的下一跳是虚拟网卡 tun0, 由 VPN 客户端接管。
  3. VPN 客户端将这个 packet 的来源地址从 192.168.0.2 改为 10.8.0.123, 转发给 VPN 服务端。
  4. VPN 服务端收到 packet. 根据本地路由规则,172.29.1.0/24 的下一跳是默认网关 172.29.1.1.
  5. 默认网关找到在同一个局域网内的机器 B (172.29.1.4).

客户端 -> 内网

为什么机器 A 的本地路由表里会有 172.29.1.0/24 这个网段的路由规则?通常情况下,这是 OpenVPN 服务端推送给客户端,由客户端在建立 VPN 连接时自动添加的。也可以由服务端自定义,比如wireguard

内网 -> 客户端

这个时候,如果机器 B 想要回复 A(比如发个 ACK),就会出问题,因为 packet 的来源地址还是 10.8.0.123, 而 10.8.0.0/24 网段并不属于当前局域网,是 VPN 服务端私有的——机器 B 往 10.8.0.123 发送的 ACK 会在某个位置(比如默认网关)遇到 "host unreachable" 而被丢弃。对于机器 A 来说,表面现象可能是连接超时或 ping 不通。

解决方法是,在 packet 离开 VPN 服务端时,将其「伪装」成来自 172.29.0.3(举例VPN 服务端的局域网地址),这样机器 B 发送的 ACK 就能顺利回到 VPN 服务端,然后发给机器 A. 这就是所谓的 SNAT。

  • SNAT: Source Network Address Translation,是修改网络包源ip地址的。
  • DNAT: Destination Network Address Translation,是修改网络包目的ip地址的。

在 Linux 系统中由 iptables 来管理,具体命令是:

iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE.

客户端 -> 另一个客户端的内网

连接 OpenVPN 的两个 client 之间可以互相通信,这是因为服务端推送的路由里包含了对应的网段。但是想从 Client A 到达 Client B 所在局域网的其他机器,还需要额外的配置。因为 OpenVPN 服务端缺少 Client B 局域网相关的路由规则。

# server.conf
push "route 172.29.0.0 255.255.0.0" # client -> Client B 给客户端推送 172.29.0.0/16 网段的路由(即这个网段的IP的信息都经过VPN)

route 172.29.0.0 255.255.0.0 #在 OpenVPN Server 上添加 172.29.0.0/16 网段的路由,具体下一跳是哪里,由 client-config 里的 iroute 指定

# 启用 client-config, 目录里的文件名对应 client.crt 的 Common Name
client-config-dir /etc/openvpn/ccd

# /etc/openvpn/ccd/client-b
iroute 172.29.0.0 255.255.0.0 # 告诉 OpenVPN Server, 172.29.0.0/16 的下一跳应该是 client-b (根据名字来)

内网与内网互访

在前两节所给的配置基础上,只需要再加一点配置,就能实现 OpenVPN 服务端所在局域网与客户端所在局域网的互访。配置内容是,在各自局域网的默认网关上添加路由,将对方局域网网段的下一跳设为 OpenVPN 服务端 / 客户端所在机器,同时用 iptables 配置相应的 SNAT 规则。

机场购买链接推荐

Based on the info in clashio, we select some cheap vpns to try.

name 每月价格(¥/GB/off on holiday) 每月单价(GB/¥) 每年单价(GB/¥) 节点数与稳定性 使用速度感觉
fastlink 2019 20/100/-30% 5 100+, 节点速度高达5Gbps 峰值 5Gbps (1)
totoro 2023 15/100/-20%(2) 6.6 ??? ???
冲浪猫 2022 16/200/-12%(3) 12.5 ??? 峰值 1Gbps
奈云机场 2021 10.6/168/-30%(4) 15.8 230624购买,240109几天全面掉线 峰值 5Gbps (6)
FatCat 2023 6/60/-20% 10 ??? 峰值 xx Gbps

detail info in table

  1. up to 6MB/s off-peak period
  2. 年付8折 + 优惠码8折 \(15*12*0.8*0.8=115.2\)
  3. 年付 150¥*0.88
  4. 年付+优惠码 128*0.7 = 89.6¥
  5. 年费+优惠码 128G每月,:46.99¥/128G or 76.36¥/256G。单价最低时间最短买法:256G,按季度买
  6. 新注册用户运行一周内测试5GB: up to 6MB/s in real download

My Choice: 单价,大小,速度,优惠码有效期

  1. 优惠码(春节 中秋 双十一)
  2. fastlink 用了两年了,还是x3很快的。但是相当于一个月只有30GB, 不够用。
  3. 奈云机场(可靠性暂时不行),冲浪猫 平衡比较好。

现在组合:奈云机场(2) + fastlink。 等fastlink过期了(1),看要不要转成 冲浪猫。

  1. 240624
  2. 241105 配置:复制订阅,订阅地址后面加 &flag=clash下载config.yaml
slow and expensive I had try

Nyacloud 喵云:只有10个节点 8¥/40GB/0.03Gbps or 17¥/128GB/0.2Gbps 平均 5GB/¥

BGP: Border Gateway Protocol

边界网关协议(Border Gateway Protocol,BGP)就是互联网的邮政服务。当有人把一封信投进邮筒时,邮政服务就会处理这封邮件,并选择一条快速、高效的路线将这封信投递给收件人。同样地,当有人通过互联网提交数据时,BGP 负责寻找数据能传播的所有可用路径,并选择最佳的路由,这通常意味着在自治系统之间跳跃。1

BGP不仅能够解决速度问题,还可以解决绕过线路故障:

IPLC: International Private Leased Circuit

中文翻译是国际私用出租线路,是指用户专用的跨国的数据、话音等综合信息业务的通信线路。通俗地说,也就是指传统的跨境专线。

延迟更低40ms、速度更快, 但是价格贵1 元 / GB。

Anycast

Anycast 是一种网络寻址和路由方法,可以将传入请求路由到各种不同的位置或“节点”。在 CDN 的上下文中,Anycast 通常会将传入的流量路由到距离最近并且能够有效处理请求的数据中心。选择性路由使 Anycast 网络能够应对高流量、网络拥塞和 DDoS 攻击。

SJF 稳定翻墙VPS

brook vpn+ Amazon American node

各种设备翻墙

教程

参考文献

OpenVPN 路由详解

Java

java运行的特点

JVM(java虚拟机)

Just-In-Time (JIT) 编译器

  • JIT编译器是一种动态编译技术,它将程序的一部分或者全部源代码或更常见的字节码在运行时编译成机器码,然后将编译后的代码替换原来的代码。
  • 字节码(英语:Bytecode)通常指的是已经经过编译,但与特定机器代码无关,需要解释器转译后才能成为机器代码的中间代码(多为虚拟机代码)。典型应用为Java虚拟机里的Java bytecode。
  • 主要优点是可以在运行时根据程序的运行情况进行优化,从而提高程序的执行效率。
  • 字节码编译是跨平台的,便于移植的。
  • 主要缺点是编译字节码导致的延迟和空间开销较大,因此只有在程序运行时间较长的情况下才能体现出优势。
  • 是提前编译(AOT)和字节码解释器(python的实现)的结合体,它的执行效率介于两者之间。

区别

  1. Java Virtual Machine (JVM) is an abstract computing machine.
  2. Java Runtime Environment (JRE) is an implementation of the JVM.
  3. Java Development Kit (JDK) contains JRE along with various development tools like Java libraries, Java source compilers, Java debuggers, bundling and deployment tools.
  4. Java SE: Java™ Platform Standard Edition 21 Development Kit - JDK™ 21
  5. Just In Time compiler (JIT) is runs after the program has started executing, on the fly. It has access to runtime information and makes optimizations of the code for better performance.

Install

Intall for topcoder

chinese ref

  1. download from website
  2. But the first download choice java 21 SDK seems not contain Java Control Panel (javacpl.exe), you need to install Java SE Development Kit 8u381 which include JDK 1.8 and JRE 1.8
  3. config Java Control Panel, add https://www.topcoder.com to allowed website (Attention: https)
  4. open ContestAppletProd.jnlp
  5. need 127.0.0.1 proxy and HTTP TUNE 1 to connect to server

需要进一步的研究学习

暂无

遇到的问题

暂无

开题缘由、总结、反思、吐槽~~

参考文献

Keyboard

It's a fucking crazy thing when you reuse a Bluetooth device, because forget how to make pair.

logitech K780

My keyboard encounter Poor contact of keyboard keys, esepeacially the ctrl

change Win/Mac/IOS configurations

iOS fn + i

Mac OS X fn + o

Windows fn + p

LEOPOLO FC980M

Bluetooth pair

Read more: official ref and ref_photo

It seems that just

  1. Open the battery cover
  2. insert AAA battery and Set the power switch to the ON position.

you can Turn on the Bluetooth.

Answer from TAOBAO

连接蓝牙方法:(我们键盘没有送蓝牙适配器)需要您电脑有蓝牙功能,

  1. 第一步背后大开关打到on,
  2. 第二步用取卡针捅一下大开关下面的孔、进入配对环节,
  3. 第三步打开电脑蓝牙搜蓝牙键盘的型号按提示连接就行。参考

Windows weird option 输入 FC980MBT 的PIN,也可以选择关闭,尤其是鼠标也需要输入时:

  1. type 00000 using original keyboard,click confirm.
  2. type 00000 using new keyboard, enter.

需要进一步的研究学习

暂无

遇到的问题

暂无

开题缘由、总结、反思、吐槽~~

参考文献

上面回答部分来自ChatGPT-3.5,没有进行正确性的交叉校验。

Interview

Keep in mind

  1. 只背⼋股⽂,是不⾏的,不太好进⼤公司。
  2. ⼤家要知道,⾯试官也是⼈,也知道候选⼈都在背⼋股⽂,⽽且⾯试官⾯过很多⼈,身经百战,你是背诵的,还是⾃⼰深刻理解过的,⾯试官⼀⾯你,就能知道你⼏⽄⼏两。也就是说,如果只会照本宣科的背⼋股⽂,⾯试会⽐较难受,碰到稍微严格的⾯试官,挖你细节,问到你不会为⽌,你会扛不住,⽆法根据情景说出⾃⼰的理解,这会给⾯试官很不好的印象,觉得你只会照猫画⻁。
  3. 在我看来,⽆论多么浅显的⼋股⽂,都要经过⾃⼰的实战经验,深度思考,再⽤⾃⼰的理解说出来,就算你的回答不是最好的答案,我觉得都没关系,你要让⾯试官看到你的潜⼒,看到你严谨的思维,清晰的表达

编程风格 (TO DO:有待拓展:编程素养)

Google C++

  1. 面向对象的数据结构思想:不要随便添加新的数据结构(边的信息),最好是在点的对象上添加。
  2. 让事情变得更简单、绝不重新发明轮子、尽可能使用经过验证的可靠技术。
  3. Time to use Class in C++
  4. Data and it's interface (复杂的数据/集合/容器和借口关系)
    1. 基类:数据,派生类:借口
  5. diff elements but in same one high level type (不同的事物,但是相同的抽象操作. )
    1. 基类:geometry(只是虚函数的框架),派生类:line, circle, Rectangle,相同操作:draw,calculate_area
    2. 基类:chart(只是虚函数的框架),派生类:line, bar, pie,相同操作:draw,push(add data)
    3. 数据格式以及初始化,要多态?
  6. Basic info & its specific application (信息的封装)
    1. 基类:基本信息,派生类:应用方向的基类
  7. useful utils (跨应用的常用轮子)

八股总结

  1. C++编程类
  2. 小贺 PDF
  3. 拓跋阿秀
  4. github interview c++
  5. 计网和操作系统
  6. 小林coding 图解
    1. 多进程通讯的方式,图解
    2. rdma, 下一代网络和互联技术

技术面

  1. 自我介绍
  2. 出彩经历介绍(项目、实习)
  3. STAR法则,也就是:“Situation: 事情是在什么情况下发生的;Task: 你的任务(难点)是什么;Action: 你的行动是什么;Result: 结果怎样。
  4. 时间占比如下,可以适当强调自己的工作 S+T:25% A:50% R:25%
  5. 技术测试(编程语法,和算法)
  6. 字节更看重编程,直接手撕各种算法

业务主管面

更宏观的问题:

  1. 职业规划为主:
  2. 详见 career blog
  3. 对各种事物的看法与价值观是否契合
  4. (越偏研究和长远发展的部门,问的越广泛。越偏业务的部门,问题越实际)

HR 面

面试官提问的:(生活相关的)

  • 配偶,家庭成员

我提问的内容

  • 工作内容:详细讨论了你去这个部门能做什么,准备安排你做什么,问你能不能胜任,保证了你是知道进去的工作内容。
  • 薪酬:注意前面两面也有问你的期望,那时候不要说太少,本人当时就是期望薪酬定的太低了,HR直接就给了。后面想反悔也不行。
  • 聊聊住址城市、升职,转正。
  • 工作节奏(上下班,周末)
  • 基本上都是8小时工作制,双休,午休一小时。弹性上班9点半到10点半。

需要进一步的研究学习

暂无

遇到的问题

暂无

开题缘由、总结、反思、吐槽~~

参考文献

上面回答部分来自ChatGPT-3.5,没有进行正确性的交叉校验。

Interview in english

Interview Preparation:

There is no set structure or format for your interview; it really just depends on the interviewer, and the direction the conversation goes, etc. You will likely be asked to explain something you worked on, and that would include some core skillset questions to check your understanding of your projects. Here are a few general suggestions to help you prepare:

1) Be prepared to speak at depth regarding any core skillset details in your background, for example: coding/technology-based questions; the two best ways to prepare for this would be to review your resume, and make sure you are able to talk at depth about skills you mentioned there, and to review the job description, and brush up on anything you might know, but feel you might not be able to go into detail about.

2) Ask good questions – about team, what we are up to, possible role/roles you might be a good fit for.

3) Read up on our website about our products and the company (many interviewers will ask what you know about us, and it is better to be prepared to answer - it shows interest in the company and what we are up to).

4) Access to a computer with an internet connection is typically required for your interviews

self-introduction in English

"Hello, I am a graduate student majoring in Computer Science and Technology at the University of Science and Technology of China. I am currently pursuing/pəˈsjuːɪŋ/ a master's degree. I completed my undergraduate studies at the same university and had the opportunity to participate in both the ASC and ISC competitions during my undergraduate years.

In my graduate studies, I have primarily focused on research related to High-Performance Computing. This includes projects such as static code analysis for Kunpeng processors, participation in program parallelization and acceleration optimization competitions, and exploring PIM (Processing in Memory) computing.

Through my academic and research experiences, I have developed a dual/ˈduːəl/ expertise /ˌekspɜːˈtiːz/ in computer microarchitecture and practical/ˈpræktɪkl/ application optimization. I have honed/hoʊnd/ the ability to swiftly identify program hotspots when faced with new applications, leveraging/ˈlevərɪdʒ/ the unique characteristics of computer systems to achieve efficient deployment and enhance program performance.

Furthermore, I have taken a keen/kiːn/ interest in emerging technologies such as artificial intelligence and machine learning. I aspire to apply these skills flexibly in fields like AI for science/HPC and AI program deployment. Thank you for considering my candidacy/ˈkændɪdəsi/ for this opportunity."

项目的介绍和关键字

参考文献

上面回答部分来自ChatGPT-3.5,没有进行正确性的交叉校验。

https://www.nowcoder.com/discuss/401041683767468032