kk Blog —— 通用基础


date [-d @int|str] [+%s|"+%F %T"]
netstat -ltunp
sar -n DEV 1

idea 安装

https://blog.csdn.net/qq_41890694/article/details/88651723

linux 2018.3.5 下载,提取码: 1314

win 2018.3.5 下载,提取码: 1314

JetbrainsIdesCrack-4.2-release.jar 下载,提取码: 1314

将 JetbrainsIdesCrack-4.2-release.jar 放到 bin 目录,对两个文件进行修改(idea.vmoptions和idea64.vmoptions),在这两个文件的最后一行添加下面这段代码

win

1
-javaagent:C:/IntelliJ IDEA 2018.3.5/bin/JetbrainsIdesCrack-4.2-release.jar

linux

1
-javaagent:/home/kk/IntelliJ_IDEA_2018.3.5/bin/JetbrainsIdesCrack-4.2-release.jar

运行 idea,选择 Activation code(激活代码)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
ThisCrackLicenseId-{
"licenseId":"ThisCrackLicenseId",
"licenseeName":"Suger",
"assigneeName":"",
"assigneeEmail":"642481395@qq.com",
"licenseRestriction":"For This Crack, Only Test! Please support genuine!!!",
"checkConcurrentUse":false,
"products":[
{"code":"II","paidUpTo":"2099-12-31"},
{"code":"DM","paidUpTo":"2099-12-31"},
{"code":"AC","paidUpTo":"2099-12-31"},
{"code":"RS0","paidUpTo":"2099-12-31"},
{"code":"WS","paidUpTo":"2099-12-31"},
{"code":"DPN","paidUpTo":"2099-12-31"},
{"code":"RC","paidUpTo":"2099-12-31"},
{"code":"PS","paidUpTo":"2099-12-31"},
{"code":"DC","paidUpTo":"2099-12-31"},
{"code":"RM","paidUpTo":"2099-12-31"},
{"code":"CL","paidUpTo":"2099-12-31"},
{"code":"PC","paidUpTo":"2099-12-31"}
],
"hash":"2911276/0",
"gracePeriodDays":7,
"autoProlongated":false}

jsp 环境初始化

jdk

https://www.oracle.com/java/technologies/javase-jdk15-downloads.html

linux 环境变量

1
2
3
vim ~/.bashrc
export JAVA_HOME=/usr/lib/jvm/jdk-15.0.1/
export PATH=$PATH:/usr/lib/jvm/jdk-15.0.1/bin

win 环境变量

右键点击我的电脑,选择属性。点击左边高级系统设置,在弹出的窗口中切换至高级,点击最下面有一个环境变量,进入环境变量设置。

此处需要配置三个系统环境变量:JAVA_HOME 、CLASSPATH、Path;

首先配置点击JAVA_HOME,点击系统变量下的新建,变量名为JAVA_HOME,变量值为安装的jdk所在的路径,我的为:c:\java\jdk-15.0.1,点击确定

然后配置CLASSPATH,与上一步相同,点击新建,变量名为CLASSPATH,变量值为 .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar; ,注意最前面有个点不能省去,最后面要有英文的分号,点击确定

最后配置Path,在系统变量中找到Path并双击它,在变量值的最后加上:%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;最后点击确定

mysql

win

https://dl.pconline.com.cn/download/2260891.html

选择 server only

系统可能需要依赖 .NET Framework 4.5.2 https://www.microsoft.com/en-us/download/confirmation.aspx?id=42642

mysql如何修改root用户的密码

1
2
格式:mysql> set password for 用户名@localhost = password('新密码'); 
例子:mysql> set password for root@localhost = password('123'); 

增加内容

1
2
3
4
5
6
7
8
create database test;
use test
create table info(id integer primary key, name varchar(30), val integer);
alter table info modify id integer auto_increment;
insert into info(name, val) values ('kk', 123);
insert into info(name, val) values ('ll', 456);
select * from info;
quit

tomcat

https://tomcat.apache.org/download-90.cgi

将 mysql-connector-java-5.1.47.jar 放到 lib/ 下

vim webapps/examples/db.jsp

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
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%>

<html>
<head>
<title>通过JSP打开数据表</title>
</head>
<body>
<%
	try {
		Class.forName("com.mysql.jdbc.Driver");  //驱动程序名
		String url = "jdbc:mysql://localhost:3306/test"; //数据库名
		String username = "root";  //数据库用户名
		String password = "123";  //数据库用户密码
		Connection conn = DriverManager.getConnection(url, username, password);  //连接状态

		if (conn != null) {
			out.print("数据库连接成功!");
			out.print("<br />");
			Statement stmt = null;
			ResultSet rs = null;
			String sql = "SELECT * FROM info;";  //查询语句
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql);
			out.print("查询结果:");
			out.print("<br />");
			out.println("姓名"+"  "+"性别 "+"  "+"年龄");
			out.print("<br />");
			while (rs.next()) {
				out.println(rs.getString("id")+"      "+rs.getString("name")+"    "+rs.getInt("val")); //将查询结果输出
				out.print("<br />");
			}
		} else {
			out.print("连接失败!");
		}
	} catch (Exception e) {
		out.print("数据库连接异常!");
	}
%>
</body>
</html>

直接运行 bin/startup.sh

打开 127.0.0.1:8080/examples/db.jsp 即可看到数据库内容

log 乱码

打开Tomcat安装源码conf文件夹下的logging.properties文件,将UTF-8改成GBK

Linux命令行截屏

ubuntu

1
sudo apt-get install scrot

centos

scrot0.8 https://github.com/dreamer/scrot

scrot0.8

http://packages.psychotic.ninja/7/base/x86_64/RPMS/giblib-1.2.4-22.el7.psychotic.x86_64.rpm

http://packages.psychotic.ninja/7/base/x86_64/RPMS/giblib-devel-1.2.4-22.el7.psychotic.x86_64.rpm

giblib-1.2.4-22.el7.psychotic.x86_64.rpm

giblib-devel-1.2.4-22.el7.psychotic.x86_64.rpm

1
2
3
4
5
6
7
8
9
yum install imlib2
yum install imlib2-devel

rpm -ivh giblib-1.2.4-22.el7.psychotic.x86_64.rpm
rpm -ivh giblib-devel-1.2.4-22.el7.psychotic.x86_64.rpm

$ ./configure
$ make
# make install

scrot https://github.com/resurrecting-open-source-projects/scrot

scrot

1
2
3
4
5
6
7
8
9
10
yum install automake
yum install autoconf
yum install autoconf-archive.noarch 
yum install libXtst-devel
yum install libXcomposite-devel

$ ./autogen.sh
$ ./configure
$ make
# make install

用Scrot截屏

1.截取整个桌面十分简单。只需运行Scrot命令,不需要任何参数,然后它会保存一张整个桌面的截屏,以(日期标记).png的文件形式保存在当前文件目录下。

1
$ scrot

你也可以指定保存目标文件夹和截图文件名。

1
$ scrot ~/Pictures/my_desktop.png

2.截取特定窗口或矩形区域

Scrot允许你在桌面选择一个特定的窗口或定义一个矩形区域来截图。使用下列命令来实现:

1
$ scrot -s

运行这个命令后,继续用你的鼠标单击任意窗口或画出一个矩形,它能够触发对选定窗口/区域的屏幕截取。(LCTT译注,还要使用鼠标,伐快乐)

有时候你选定的区域或窗口可能会被桌面的其它窗口部分遮挡。在这种情况下,你在截屏前需要一点时间来清理那个部分。那正是延迟截屏能够帮到你的,就像下面所描述的那样。

3.延迟截屏

延迟截取在各种情况下都很实用。就在截图前,你可能想要移动一下窗口,激活一下菜单,或是触发特定时间(如通知)等等。 使用“-d N”参数,我们可以将截屏进程延迟N秒。

1
$ scrot -s -d 5

4.调整截屏质量

你可以在1到100的范围内调整截取的图像质量(数字越大质量越高)。默认质量设置为75。

1
$ scrot -q 50

5.调整截屏尺寸

你可以在1到100的范围内调整截取的图像尺寸(数字越大尺寸越大)。减小截屏的尺寸到原图的10%:

1
$ scrot -t 10

6.将截取的截屏传递给其它命令

Scrot允许你发送保存的截屏图像给任意一个命令作为它们的输入。这个选项在你想对截屏图像做任意后期处理的时候十分实用。截屏的文件名/路径跟随于“$f”字符串之后。

1
$ scrot -e 'mv $f ~/screenshots'