1、 查看当前sql-mode

select @@sql_mode;
MySQL @@sql_mode

2、设置 sql-mode

拷贝原来的值,移除 NO_ZERO_IN_DATENO_ZERO_DATE 两项即可

SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';

3、使新的 sql-mode 生效

FLUSH PRIVILEGES;

1、准备安装环境

sudo apt-get install python python-twisted python-openssl python-setuptools intltool python-xdg python-chardet geoip-database python-libtorrent python-notify python-pygame python-glade2 librsvg2-common xdg-utils python-mako python-dev

2、获取源码并安装

(1)获取源码

git clone git://deluge-torrent.org/deluge.git
cd deluge
git checkout -b master remotes/origin/master

(2)安装

python setup.py build
sudo python setup.py install --install-layout=deb

如果出现 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 错误,执行:

sudo apt-get install python-dev  \
     build-essential libssl-dev libffi-dev \
     libxml2-dev libxslt1-dev zlib1g-dev \
     python-pip

3、配置 deluge 和 deluge-web 服务

sudo cp packaging/systemd/deluged.service /etc/systemd/system/deluged.service
sudo cp packaging/systemd/deluge-web.service /etc/systemd/system/deluge-web.service

4、启动 deluged 和 deluge-web 服务,并设置自启动

sudo systemctl start deluged
sudo systemctl enable deluged

sudo systemctl start deluge-web
sudo systemctl enable deluge-web

5、开启远程访问(可选)

deluge-web默认只允许本地访问。默认端口:8112,默认密码:deluge

#启用远程访问
deluge-console "config -s allow_remote True"

#禁用远程访问
deluge-console "config allow_remote"

访问地址:http://你的IP:8112

deluge web

卸载 Deluge

sudo systemctl stop deluge-web
sudo systemctl disable deluge-web
sudo systemctl stop deluged
sudo systemctl disable deluged
sudo rm -rf /etc/systemd/system/deluge*

sudo rm -rf /usr/bin/deluge*

sudo rm -rf /usr/lib/python2.7/dist-packages/deluge*

利用 SheetJS js-xlsx 读取 Execl 数据转为JSON

<script type="text/javascript" src="Script/jquery.min.js"></script>
<script type="text/javascript" src="Script/js-xlsx/shim.min.js"></script>
<script type="text/javascript" src="Script/js-xlsx/xlsx.full.min.js"></script>
<script type="text/javascript">
	$(function () {
		$('.file-upload').change(function () {
			var $self = $(this);
			if (!this.files.length) {
				return;
			}
			//利用 FileReader 读取用户选中的Execl文件
			var reader = new FileReader();
			reader.onload = function (e) {
				var data = new Uint8Array(e.target.result);
				var workbook = XLSX.read(data, { type: 'array' });
				//获取第一个 Sheet 名称
				var sheetName = workbook.SheetNames[0];
				//获取第一个 Sheet
				var sheet = workbook.Sheets[sheetName];
				//转换为JSON格式数组
				var sheetJSONData = XLSX.utils.sheet_to_json(sheet);
			};
			reader.readAsArrayBuffer(this.files[0]);
		});
	});
</script>

相关文件下载

[DllImport("rpcrt4.dll", SetLastError = true)]
static extern int UuidCreateSequential(out Guid guid);

public static Guid GenerateSequentialGuid()
{
    Guid guid;
    int result = UuidCreateSequential(out guid);
    if (result != 0)
    {
        throw new ApplicationException("Create sequential guid failed: " + result);
    }
    return guid;
}

DateTime 转 Unix 时间戳

DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
int unixTimeSpan = (int)(time - startTime).TotalSeconds;

Unix 时间戳转 DateTime

DateTime dateTimeStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
long longTime = long.Parse(timeStamp + "0000000");
TimeSpan toNow = new TimeSpan(longTime);
DateTime dateTime = dateTimeStart.Add(toNow);

MySQL

1、安装 MySQL 源

wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
sudo rpm -Uvh mysql80-community-release-el7-3.noarch.rpm

2、选择想要安装的版本

使用MySQL Yum repository 时,默认选择安装MySQL的最新GA版本。 如果是你想要安装的,你可以跳到下一步,用 Yum 安装 MySQL。

yum repolist all | grep mysql

如果安装最新的GA版本,不需要进行任何配置。 要从最新GA版本以外的特定版本 安装最新版本,请在运行安装命令之前禁用最新GA版本的子 repository 并启用特定版本的子 repository。执行以下命令来执行此操作,这些命令禁用8.0版本的子 repository 并启用5.7版本的子 repository:

sudo yum-config-manager --disable mysql80-community
sudo yum-config-manager --enable mysql57-community

运行以下命令并检查其输出来验证是否已启用和禁用了正确的子 repository

yum repolist enabled | grep mysql

3、开始安装 MySQL

sudo yum install mysql-community-server

4、启动 MySQL 服务

sudo systemctl start mysqld.service

检查 MySQL 是否正确启动:

sudo systemctl status mysqld.service

5、修改登录密码

通过以下命令查看默认的临时密码:

sudo grep 'temporary password' /var/log/mysqld.log

登录 MySQL

mysql -u root -p

修改密码,并使密码生效 (注意 NewPassword 替换为你想要设置的登录密码) :

ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword';
FLUSH PRIVILEGES;

6、开启 root 用户远程访问(可选)

执行以下命令(注意 Password 替换为你想要设置的登录密码):

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Password' WITH GRANT OPTION;
FLUSH PRIVILEGES;

官方英文安装文档:https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/

系统要求:

要安装Docker CE,仅支持以下Ubuntu 64位版本:

  • Cosmic 18.10
  • Bionic 18.04 (LTS)
  • Xenial 16.04 (LTS)

Docker CE 支持 x86_64,amd64, armhf, arm64, s390x (IBM Z), and ppc64le (IBM Power) 架构.

安装 Docker CE

1、卸载旧版 Docker

老版本的 Docker 被称为 dockerdocker.io 或 docker-engine 。如果安装了,需要先卸载它们以及相关的依赖项。

$ sudo apt-get remove docker docker-engine docker.io containerd runc

保留 /var/lib/docker/内容。

2、安装 Docker CE

(1)更新 apt 包索引:

$ sudo apt-get update

(2)安装 repository 和相关依赖:

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

(3)添加 Docker 官方 GPG key:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

通过搜索指纹的最后8个字符,确认含有指纹9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88的密钥。

$ sudo apt-key fingerprint 0EBFCD88
pub   rsa4096 2017-02-22 [SCEA]
      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid           [ unknown] Docker Release (CE deb) <docker@docker.com>
sub   rsa4096 2017-02-22 [S]

(4)添加 repository

根据不同架构选择需要添加的 repository

# x86_64 / amd64
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

#armhf
$ sudo add-apt-repository "deb [arch=armhf] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

#arm64
$ sudo add-apt-repository "deb [arch=arm64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

#ppc64le (IBM Power)
$ sudo add-apt-repository "deb [arch=ppc64el] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

#s390x (IBM Z)
$ sudo add-apt-repository "deb [arch=s390x] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

(5)更新 apt 包索引:

$ sudo apt-get update

(6)安装最新版 Docker CE 和 containerd

$ sudo apt-get install docker-ce docker-ce-cli containerd.io

通过运行 hello-world 镜像验证是否正确安装了Docker CE:

$ sudo docker run hello-world

官方英文安装文档:https://docs.docker.com/install/linux/docker-ce/ubuntu/

Docker

Docker是一个开放源代码软件项目,让应用程序部署在软件货柜下的工作可以自动化进行,借此在Linux操作系统上,提供一个额外的软件抽象层,以及操作系统层虚拟化的自动管理机制。

1、卸载旧版 Docker

老版本的 Docker 被称为 dockerdocker-engine 。如果安装了,需要先卸载它们以及相关的依赖项。

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

2、添加 Docker CE 源

wget https://download.docker.com/linux/centos/docker-ce.repo
sudo mv docker-ce.repo /etc/yum.repos.d/docker-ce.repo

3、安装 Docker CE 和 Containered 最新版

sudo yum install docker-ce docker-ce-cli containerd.io

4、启动 Docker CE 服务

#启动 docker
sudo systemctl start docker
#设置 docker 自启动
sudo systemctl enable docker

查看 Docker CE 版本

docker -v

Docker version 18.09.6, build 481bc77156

官方英文安装: https://docs.docker.com/install/linux/docker-ce/centos/