jonssonyan's Website

保持热爱,奔赴山海。

包名称

包名应该为小写单词,不要使用下划线或者混合大小写。

1
2
package domain
package main

文件命名

应该为小写单词,使用下划线分隔各个单词。

阅读全文 »

环境搭建

参考:Windows10配置Rust开发环境

项目目录

默认cargo新建工程之后会有以下文件

  • src/:源代码文件夹
  • src/main.rs:程序入口
  • target/:用来存放debug/release时的文件,通常不需要我们手动编辑
  • .gitignore:Git中忽略文件和文件夹
  • Cargo.lock:由cargo维护的项目相关依赖的具体信息,不需要我们手动编辑
  • Cargo.toml:由我们编辑的项目名称、项目版本、项目作者,以及项目所需相关依赖
阅读全文 »

我常用的操作系统是Windows 10 企业版 LTSC,我经常会在B站和YouTube直播,我使用的软件都是免费开源,而且是持续维护的。这一套软件是我摸索了一段时间,对比之后选择的 目前最优方案。

关于直播软件,除非平台指定自家研发的直播软件,比如抖音。其余平台我只推荐OBS Studio

OBS-studio: https://obsproject.com/

但是它有一个缺点: 不支持系统代理,所以代理这块我推荐使用proxychains

proxychains-windows: https://github.com/shunf4/proxychains-windows

阅读全文 »

学习了太多的语言和框架,最终会导致很多语法和规范会搞混,相比较Java和Go统一的文件和文件命名来说,Vue.js的规范更多一些,养成一个好的开发习惯,可以让我们的项目一目了然。

命名规范

组件命名

全部统一大驼峰(PascalCase)或者肉串(kebab-case)

文件夹命名

阅读全文 »

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
49
50
51
52
53
54
55
56
57
58
import json
import socket

import requests
from lxml import etree
from tld import get_fld

url = 'https://sp1.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php?query={}&resource_id=5809&format=json'
record_url = 'https://icp.chinaz.com/{}'
proxies = {"http": None, "https": None}


class GetHost:
# 域名
domain = ''
# IP地址
ip = ''
# IP归属地
location = ''
# 主办单位名称
org_name = ''
# 主办单位性质
sponsor_nature = ''
# 网站名称
website_name = ''

def __init__(self, domain, ip):
self.domain = domain
self.ip = ip
self.get_host_info()

def get_host_info(self):
if self.ip == '':
self.ip = socket.gethostbyname(self.domain)
response = requests.get(url.format(self.ip), proxies=proxies)
json_obj = json.loads(response.text)
info = json_obj['data']
self.location = info[0]['location']
if self.domain != '':
response = requests.get(record_url.format(get_fld(self.domain, fix_protocol=True)),
proxies=proxies)
html = etree.HTML(response.content)
record_info = html.xpath('//li[@class=\'bg-gray clearfix\']')
self.org_name = record_info[0].xpath('./p/a/text()')[0]
record_info_1 = html.xpath('//li[@class=\'clearfix\']')
self.sponsor_nature = record_info_1[0].xpath('./p/strong/text()')[0]
self.website_name = record_info_1[1].xpath('./p/text()')[0]


if __name__ == '__main__':
host = GetHost('www.qq.com', '')
print('域名:{}'.format(host.domain))
print('IP:{}'.format(host.ip))
print('归属地:{}'.format(host.location))
print('主办单位名称:{}'.format(host.org_name))
print('主办单位性质:{}'.format(host.sponsor_nature))
print('网站名称:{}'.format(host.website_name))

输出结果

1
2
3
4
5
6
域名:www.qq.com
IP:101.91.22.57
归属地:上海市 电信
主办单位名称:深圳市腾讯计算机系统有限公司
主办单位性质:企业
网站名称:腾讯网

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
import telnetlib
from socket import *


# 使用socket
def socket_scan(host, port):
conn = socket(AF_INET, SOCK_STREAM)
conn.settimeout(2)
try:
conn.connect((host, port))
print(host, port, 'is available')
except Exception:
print(host, port, 'is not available')
finally:
conn.close()


# 使用telnet
def telnet_scan(host, port):
t = telnetlib.Telnet()
try:
t.open(host, port, timeout=2)
print(host, port, 'is available')
except Exception:
print(host, port, 'is not available')
finally:
t.close()


def main():
host = '127.0.0.1'
for port in range(80, 90):
socket_scan(host, port)


if __name__ == '__main__':
main()

运行结果:

1
2
3
4
5
6
7
8
9
10
127.0.0.1 80 is not available
127.0.0.1 81 is not available
127.0.0.1 82 is not available
127.0.0.1 83 is not available
127.0.0.1 84 is not available
127.0.0.1 85 is not available
127.0.0.1 86 is not available
127.0.0.1 87 is not available
127.0.0.1 88 is not available
127.0.0.1 89 is not available

虽说现在行情是差了一些,面试机会少了一些,但是大部分公司还是或多或少的招人,春招秋招都在进行。有人离职就有人入职。所以如果你还没约到面试,不要灰心,多投多面,自然而然面试的感觉也就有了。

投简历的技巧

  1. 月底投 hr 冲 kpi 概率比较大(不是说不让投,而是说要有心理准备)
  2. 投最近活跃的职位(3 天前活跃的基本就不要看了)
  3. 打招呼用语用自定义的,比如说,我是 xxx,几年经验,会什么,之前是做什么的,我能投简历给你看看么?这样获得回复的几率会大一些
  4. 岗位描述很宽泛的很可能是为了宣传公司
  5. 多个招聘软件看看,别只会用 BOSS 直聘
  6. 网上或者找朋友要一个内推码或许有用
  7. 面试前一定要刷面试题,不喜欢背也要刷,可以应付大部分面试
  8. 如果工作经验 3 年以上,项目要侧重准备

高频面试题

分享一些我最近面试遇到的面试题,我面试的是 Java 开发岗,1-5 年工作经验,希望对大家有帮助,也希望大家可以找到自己满意的工作。

阅读全文 »

0x0. Demo结构

目录结构

依赖参考:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
module grpc-example

go 1.18

require (
github.com/golang/protobuf v1.5.2 // indirect
golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 // indirect
golang.org/x/text v0.3.3 // indirect
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
google.golang.org/grpc v1.48.0 // indirect
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
)

0x1. 环境准备

阅读全文 »

0x0. 环境准备

本文服务器的公网IP:192.168.56.101

  • OS version: Ubuntu 22
  • CPU Architecture: x86_64
  • K8s version: v1.29

0x1. 安装依赖

1
2
3
4
5
6
7
apt install -y \
curl \
wget \
systemd \
lrzsz \
bash-completion \
gpg
阅读全文 »

本文主要介绍 Nacos,它是阿里巴巴开源的管理微服务的平台,在国内很多公司都在使用 Nacos 作为微服务的注册中心和全局配置中心,而且它在国内的中文文档比较丰富,比较是国产开源的,而且背后有阿里撑腰,目前软件还是一直在更新当中,于是我就开始学习 Nacos,全局配置管理和配置共享这两个功能还是很实用的。废话不多说,开始今天的教程。

0x0. 介绍

Nacos 主要作用有 2 个

  1. 实现服务注册与发现
  2. 作为配置中心

0x1. 安装 Nacos

阅读全文 »

0x0. 相关概念

1). channel

Rust 发布在三个不同的 channel 上:stable、beta、nightly,简单说就是三种不同的版本。

  • stable:Rust 的稳定版本,每 6 周发布一次。
  • beta:Rust 的公开测试版本,将是下一个 stable 版本。
  • nightly:每天更新,包含以一些实验性的新特性。

2). toolchain

阅读全文 »
0%