包含标签 2016 的文章

Sublime使用记录

 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
1. python3 new build system

{

    "cmd": ["C:/path/python.exe","-u","$file"],

    "file_regex":"^[ ]*File \"(...*?)\", line ([0-9]*)",

    "selector":"source.python",

}

2. package control install sublimerepl
需要连接vpn

3. 设置快捷键
preferences->Key Binding-User,写入以下内容

[
    { "keys": ["f5"], "caption": "SublimeREPL:Python", 
                      "command": "run_existing_window_command", "args":
                      {
                           "id": "repl_python_run",
                           "file": "config/Python/Main.sublime-menu"
                      } 
    },
]

4. 快捷键
发现sublime真是好用啊。

ctrl+shift+/ 多行注释

选中多行,按下ctr+shift+L,可在多行行尾编辑,行首编辑需要按下右箭头 <--,行尾编辑按下-->

shift+右击上下拉
……

阅读全文

MySQL8.0安装使用(centos8)

一、 简单介绍

MySQL(官方发音为/maɪ ˌɛskjuːˈɛl/“My S-Q-L”[5],但也经常被错误读作/maɪ ˈsiːkwəl/“My Sequel”)是一个开放源码的关系数据库管理系统.

……

阅读全文

Redis安装使用

一、 简单介绍 Redis是一个开源(BSD授权)的基于内存键值对存储数据库,也常用来做缓存和消息中介。它支持字符串、哈希、列表、集合等多种数据结构。Redis内置了复制、Lua脚本、事务和磁盘持久性,并通过哨兵(Redis Sentinel)和集群(Redis Cluster)自动分区提供高可用性。

……

阅读全文

Shell知识点合集

  1. 数组
1
2
3
4
5
arr=(str1 str2 str3)
for i in ${arr[@]}
do
echo $i
done
  1. 预定义变量
1
2
3
4
5
6
$# 表示命令中位置参数的数量
$* 表示所有的位置参数的内容
$? 表示命令执行后的返回的状态,用于检查上一个命令的执行是否正确。在linux中,命令退出状态为0表示命令执行正确,任何非0值的表示命令执行错误。
$$ 表示当前进程的进程号
$! 表示后台运行的最后一个进程的进程号
$0 所有参数
  1. 测试语句
 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
63
-eq Equal to = Equal to   
-ne Not equal to != Not equal to
-lt Less than \< Less than (ASCII) *
-le Less than or equal to
-gt Greater than > Greater than (ASCII) *
-ge Greater than or equal to
re-directs output of one file to another.
-a file
True if file exists.
-b file
True if file exists and is a block special file.
-c file
True if file exists and is a character special file.
-d file
True if file exists and is a directory.
-e file
True if file exists.
-f file
True if file exists and is a regular file.
-g file
True if file exists and is set-group-id.
-h file
True if file exists and is a symbolic link.
-k file
True if file exists and its ``sticky'' bit is set.
-p file
True if file exists and is a named pipe (FIFO).
-r file
True if file exists and is readable.
-s file
True if file exists and has a size greater than zero.
-t fd True if file descriptor fd is open and refers to a terminal.
-u file
True if file exists and its set-user-id bit is set.
-w file
True if file exists and is writable.
-x file
True if file exists and is executable.
-G file
True if file exists and is owned by the effective group id.
-L file
True if file exists and is a symbolic link.
-N file
True if file exists and has been modified since it was last read.
-O file
True if file exists and is owned by the effective user id.
-S file
True if file exists and is a socket.
file1 -ef file2
True if file1 and file2 refer to the same device and inode numbers.
file1 -nt file2
True if file1 is newer (according to modification date) than file2, or if file1 exists and file2 does not.
file1 -ot file2
True if file1 is older than file2, or if file2 exists and file1 does not.
-o optname
True if the shell option optname is enabled. See the list of options under the description of the -o option to the set builtin below.
-v varname
True if the shell variable varname is set (has been assigned a value).
-z string
True if the length of string is zero.
string
-n string
True if the length of string is non-zero.
  1. 发送邮件
1
2
echo "content" | mail -s title 1248247511@qq.com
#mail 命令依赖 yum install mailx
  1. 计算
1
2
echo `expr 1 + 1`
echo "1+3","ALL" | bc
  1. 函数

函数的定义和调用

……

阅读全文

Mysql命令合集

# 连接
shell# mysql -h$ip -P$port -u$user -p

#查看binlog文件
mysql> show binary logs;

#查看binlog内容
mysql> show binlog events in 'mysql-bin.001294';

#刷新生成新的binlog文件
mysql> flush logs;

#删除binlog
> PURGE MASTER LOGS TO 'MySQL-bin.010';  //清除MySQL-bin.010日志
> PURGE MASTER LOGS BEFORE '2008-06-22 13:00:00';   //清除2008-06-22 13:00:00前binlog日志
> PURGE MASTER LOGS BEFORE DATE_SUB( NOW( ), INTERVAL 3 DAY);  //清除3天前binlog日志BEFORE,变量的date自变量可以为'YYYY-MM-DD hh:mm:ss'格式。

# 查看binglo详细信息(比如binlog为row格式的),position可以通过show binlog events确认.
shell# mysqlbinlog -vv .\data\binlog.000013 --start-position=2738 --stop-position=2973;

#全局锁
mysql> Flush tables with read lock;


mysql> show engine innodb status

mysql> show variables like 'transaction_isolation';


alter table t engine = InnoDB # 重建表
analyze table t 其实不是重建表,只是对表的索引信息做重新统计,没有修改数据,这个过程中加了 MDL 读锁;
optimize table t 等于 recreate+analyze。

#备份
mysqldump -uroot --single-transaction --master-data=2 --routines --striggers --events --set-gtid-purged=OFF --all-databases -p > /tmp/t.sql
……

阅读全文