commit
5ccfaba2c3
@ -0,0 +1,12 @@
|
||||
*.json
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
@ -0,0 +1,24 @@
|
||||
create SEQUENCE table_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
CREATE OR REPLACE FUNCTION "public"."snow_next_id"(OUT "result" int8)
|
||||
RETURNS "pg_catalog"."int8" AS $BODY$
|
||||
DECLARE
|
||||
our_epoch bigint := 1314220021721;
|
||||
seq_id bigint;
|
||||
now_millis bigint;
|
||||
shard_id int := 5;
|
||||
BEGIN
|
||||
seq_id := nextval('table_id_seq') % 1024;
|
||||
SELECT FLOOR(EXTRACT(EPOCH FROM clock_timestamp()) * 1000) INTO now_millis;
|
||||
result := (now_millis - our_epoch) << 23;
|
||||
result := result | (shard_id << 10);
|
||||
result := result | (seq_id);
|
||||
END;
|
||||
$BODY$
|
||||
LANGUAGE plpgsql VOLATILE
|
||||
COST 100
|
@ -0,0 +1,7 @@
|
||||
```sql
|
||||
导出:
|
||||
export PGPASSWORD=密码 && /opt/pgsql/bin/pg_dump -U 业务用户名 -d 库名 -h 127.0.0.1 --port=端口 -w > bak.sql
|
||||
|
||||
导入:
|
||||
export PGPASSWORD=密码 && /opt/pgsql/bin/psql -U 业务用户名 -d 库名 -h 127.0.0.1 --port=端口 -w -f bak.sql
|
||||
```
|
@ -0,0 +1 @@
|
||||
beeline -u "jdbc:hive2://x.x.x.x:10000/default;principal=hive/host@DC1.FH.COM;hive.server2.proxy.user=abc=abccc"
|
@ -0,0 +1,5 @@
|
||||
* 批量删除某类文件
|
||||
|
||||
```sql
|
||||
get-childitem * -include *.jar -recurse|remove-item
|
||||
```
|
@ -0,0 +1,107 @@
|
||||
* 显示前N个
|
||||
|
||||
```
|
||||
ll -lht|head -n 20
|
||||
```
|
||||
|
||||
* 压缩命令过长
|
||||
|
||||
```shell
|
||||
find ./ -name '*' -print |zip files -@
|
||||
```
|
||||
|
||||
* 合并文件
|
||||
|
||||
```sql
|
||||
cat *.txt > target.txt
|
||||
```
|
||||
|
||||
* 配置定时任务
|
||||
|
||||
```sql
|
||||
root 用户
|
||||
vim /etc/crontab
|
||||
|
||||
SHELL=/bin/bash
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
MAILTO=root
|
||||
|
||||
# For details see man 4 crontabs
|
||||
|
||||
# Example of job definition:
|
||||
# .---------------- minute (0 - 59)
|
||||
# | .------------- hour (0 - 23)
|
||||
# | | .---------- day of month (1 - 31)
|
||||
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
|
||||
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
|
||||
# | | | | |
|
||||
# * * * * * user-name command to be executed
|
||||
20 04 * * * root reboot
|
||||
|
||||
# 加载配置
|
||||
crontab /etc/crontab
|
||||
|
||||
# 重启crontab服务
|
||||
systemctl restart crond.service
|
||||
```
|
||||
|
||||
* 查看上一次启动
|
||||
|
||||
```sql
|
||||
who -b
|
||||
```
|
||||
|
||||
* 切分文件
|
||||
|
||||
```sql
|
||||
# 按大小切分
|
||||
split -b 100m xxxx
|
||||
# 按行切分
|
||||
split -l xxxx
|
||||
# 设置拆分后文件名,指定数字后缀
|
||||
split -b 100m -d xxxx xxxx_part_
|
||||
```
|
||||
|
||||
* 显示文件大小
|
||||
|
||||
```sql
|
||||
du -sh xxxx
|
||||
```
|
||||
|
||||
* grep
|
||||
|
||||
```sql
|
||||
# 高亮查找结果
|
||||
grep --color "test" catalina.out
|
||||
# 显示在第几行
|
||||
grep -n test catalina.out
|
||||
```
|
||||
|
||||
* zip
|
||||
|
||||
```shell
|
||||
# 压缩
|
||||
zip -r ./xxx.zip ./*
|
||||
# 解压
|
||||
unzip xxx.zip
|
||||
# 查看压缩文件内容
|
||||
unzip -v xxx.zip
|
||||
# 从zip中删除xxx.txt文件
|
||||
zip xxx.zip -d xxx.txt
|
||||
```
|
||||
* 软链接
|
||||
|
||||
```shell
|
||||
ln -s 源文件名 软链接文件名
|
||||
```
|
||||
|
||||
* 查看端口占用情况
|
||||
|
||||
```shell
|
||||
# 查看所有
|
||||
lsof -i
|
||||
# 查看指定端口
|
||||
lsof -i:8080
|
||||
# 查看文件进程
|
||||
lsof xxx.txt
|
||||
```
|
@ -0,0 +1,5 @@
|
||||
* 计算组合数
|
||||
|
||||
$$
|
||||
x=n(n-1)/2
|
||||
$$
|
Loading…
Reference in new issue