HTTPClient的使用

引入

在pom.xml插入:

1
2
3
4
5
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>

使用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
public static String doGet(URL url) throws Exception {
String content;
HttpHost proxyHost = new HttpHost("127.0.0.1",7890);
DefaultProxyRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxyHost);
CloseableHttpClient httpclient = HttpClients.custom()
.setRoutePlanner(routePlanner)
.build();
HttpGet httpGet = new HttpGet(url.toString());
CloseableHttpResponse response = null;
try {

response = httpclient.execute(httpGet);
content = EntityUtils.toString(response.getEntity(), "UTF-8");
System.out.println("内容长度:" + content.length());
return content;

} finally {
if (response != null) {
response.close();
}
httpclient.close();
}

}

查看任意网站使用的技术栈

浏览器插件

点击下载(自备梯子)

然后固定到快捷栏

然后就可以看到网站使用的技术栈

在线查看

打开这个网站

输入要查看的网站地址即可

Java获取外网ip

k

看了下网上的方法

思路没错

但是有bug

Google上找了两页没一个能用的

然后自己写了个

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
59
60
61
62
public static String getIP( ) {
String httpurl = "https://www.taobao.com/help/getip.php";
HttpURLConnection connection = null;
InputStream is = null;
BufferedReader br = null;
String result = null;// 返回结果字符串
try {
// 创建远程url连接对象
URL url = new URL(httpurl);
// 通过远程url连接对象打开一个连接,强转成httpURLConnection类
connection = (HttpURLConnection) url.openConnection();
// 设置连接方式:get
connection.setRequestMethod("GET");
// 设置连接主机服务器的超时时间:15000毫秒
connection.setConnectTimeout(15000);
// 设置读取远程返回的数据时间:60000毫秒
connection.setReadTimeout(60000);
// 发送请求
connection.connect();
// 通过connection连接,获取输入流
if (connection.getResponseCode() == 200) {
is = connection.getInputStream();
// 封装输入流is,并指定字符集
br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
// 存放数据
StringBuffer sbf = new StringBuffer();
String temp = null;
while ((temp = br.readLine()) != null) {
sbf.append(temp);
sbf.append("\r");
}
result = sbf.toString();
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
// 关闭资源
if (null != br) {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (null != is) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
connection.disconnect();// 关闭远程连接
}
result = result.substring(16);
result = result.replace("\"","");
result = result.replace("}","");
result = result.replace(")","");
System.out.println(result);
return result;
}

minecraft故事模式本体加中文包

先上截图

安装方法

下载游戏本体带语言包的存档

若速度慢可以使用idm

下载完之后

随便放到一个地方

然后先运行游戏一次

这时候在C/User/Username/Documents下会生成Telltale Games文件夹

把下载到的语言包放在Documents文件夹

然后打开游戏

可能会提示无法连接到服务器

这时候使用小键盘的上下左右键

选择禁用云存储

然后

开始玩吧

maven报错Unsupported class file major version 60

原因

maven-shade-plugin不支持Java16

解决方法

使用快照版的maven-shade

在pom.xml合适的地方插入

1
2
3
4
5
6
<pluginRepositories>
<pluginRepository>
<id>maven-snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>

然后把maven-shade-plugin的版本改为3.3.0-SNAPSHOT (idea可能会报错 不用管)

例如

1
2
3
4
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0-SNAPSHOT</version>

即可正常编译

BetterDiscord-增强-美化你的discord

什么是discord

Discord是一家游戏聊天应用与社区,Discord从游戏语音、IM工具服务起家,随后转向直播平台,进而开设游戏商店的社区平台,成为游戏玩家在游戏中沟通协作的首选工具 –百度百科

当然,discord不仅仅局限于游戏

因为它不受中国政府控制

所有它前些年被墙了

现在好像解封了

什么是BetterDiscord

BetterDiscord 通过使用新功能对其进行增强,从而扩展了 DiscordApp 的功能。

它可以让你安装插件,主题

下载,安装BetterDiscord

你需要先安装discord,才能安装BetterDiscord

Discord下载地址: 点击打开

然后下载BetterDiscord

安装

选择你的Discord路径

稍等即可

插件,主题

主题

主题允许您使用 CSS 完全自定义您的客户端。您可以制作自己的主题,也可以从我们的社区下载各种主题。

主题下载地址 点击

启用方法

打开设置

打开 主题

点击 “打开主题文件夹”

把你下载到的主题复制进去

下载到的主题应该是一个css文件

然后回到discord

启用主题

即可见效

示例/欣赏

插件的安装

打开 插件下载页面

个人觉得 除了Google翻译,其他插件没啥用

安装方法与主题类似

不说了

使用效果

image-20210707143839551

idea无限试用工具

废话不多说

下载地址

点击下载

使用方法

QQ截图20210707095422.png

从本地安装这个插件

安装后重启idea

如果你已经过了30天试用期

先进ide

打开Help→eval reset

点击右下角的reset

重启ide

然后右下角的小勾 打上

这样每次重启自动重置试用

就ok了

win10下解决uwp软件不走系统代理

原因

uwp软件似乎有个机制

默认情况下 uwp不能走代理 也不能访问本地网络

解决

win+r 打开regedit

打开HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Mappings

displayname就是软件名字

然后按键盘上的↓键

一个个找

找到你想要让它走代理的软件

把它的sid(图中红线画出来的即是sid 例如S-1-15-2-808779194-4211363634-1509594027-924395884-1379812466-1142895027-4280632089)复制出来

InqzEi.jpg

然后以管理员权限打开cmd

输入

1
CheckNetIsolation.exe loopbackexempt -a -p=SID

看到 完成

即可

OneDrive

废话

介绍个白嫖5T OneDrive的方法

是正规渠道

某些非正规渠道有可能翻车

我就遇到过

这个方法

叫 E5开发者订阅

申请很简单

微软也只会用很简单的方法验证你是不是开发者

很容易绕过

用到的链接

申请开发者订阅 https://developer.microsoft.com/zh-cn/microsoft-365/dev-program

修改默认存储空间大小 https://admin.onedrive.com/?v=StorageSettings

链接github https://developer.microsoft.com/zh-cn/microsoft-365/profile/settings/accounts-linked

正文

打开 https://developer.microsoft.com/zh-cn/microsoft-365/dev-program

点击 立即加入

然后登录你的微软账号

没有的话注册一个

我已经申请过了

没法演示

就随便找了张图

然后他会叫你选择国家 根据实际选择

公司可以随便写

输入用户名 和域

验证手机号

可能需要 科学上网

但我申请的时候似乎不需要

然后

你可以看到这样的界面

账号就申请完成了

修改默认存储空间大小

打开 https://admin.onedrive.com/?v=StorageSettings

可以看到这样的界面

把1024修改成5120即可

就变成5T了

最后

登录OneDrive客户端即可

续期

申请到的账号

只有90天有效期

但是可以通过某些方法续订

比如 链接github 调用微软api

github

打开https://developer.microsoft.com/zh-cn/microsoft-365/profile/settings/accounts-linked

点击 链接

可能会跳转到github

授权即可

github还可以用来搭建静态博客

一举两得

调用微软api

另一种续期的方法

这种方法还可搭建OneDrive网盘

下期介绍