jonssonyan's Website

保持热爱,奔赴山海。

背景是需要开发一些自动化程序,由此想到了,可以通过adb调试安卓手机,通过USB连接线连接至电脑主机,然后写一些python程序自动化操作手机,以此来代替重复的操作,效率比人工高很多,但是考虑到购买手机需要较高的成本,所以本文介绍安装安卓虚拟机,并通过adb调试局域网内的安卓虚拟机。

阅读全文 »

VirtualBox 除了可以安装 Linux、Windows 系统之外,还可以安装安卓系统,那不就相当于一个模拟器了,省的再去下载夜神,逍遥之类的定制化模拟器。借此机会,实践一下。

阅读全文 »

最近折腾给路由器刷一个系统(老毛子),不然每天到家开电脑或者玩手机都要在后台挂一个软件,不仅是加长了使用的链路,而且对于手机电池也是损耗。 用路由器的好处是可以辐射一定的范围,只要连上指定的WIFI就可以上网, 最主要是的一部分软件没有设置代理的方式(比如:OBS),还要自己通过别的工具才能对指定的软件进行代理 ,这无疑是加大了自己的折腾成本,不如路由器全局代理一劳永逸。

阅读全文 »

指定脚本解释器

  1. #!/bin/bas#!/bin/sh
  2. #!/usr/bin/env bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH

1和2的区别见以下2篇文章。大致意思是,第二种方式是自己去$PATH下找bash

  1. Why is it better to use “#!/usr/bin/env NAME” instead of “#!/path/to/NAME” as my shebang?
  2. What is the difference between “#!/usr/bin/env bash” and “#!/usr/bin/bash”?

声明版本信息

阅读全文 »

包名称

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

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
阅读全文 »
0%