Jenkins
修改时区
System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone', 'Asia/Shanghai')
System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone', 'Asia/Shanghai')
yum install mailx -y
vi /etc/mail.rc
# wkj config
set smtp="smtps://smtp.exmail.qq.com:465"
set from=发送的邮箱(与smtp-auth-user必须一致)
set smtp-auth=login
set smtp-auth-user=发送的邮箱(与from必须一致)
set smtp-auth-password=授权密码
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb
echo 内容 | mailx -v -s 主题 -a 附件 接收邮箱
egrep -i -r 'killed' /var/log
find ./ -name '*.png' | xargs rm -f
systemctl restart docker
docker-compose up -d
docker-compose down
docker exec -it 容器名 bash
docker logs --tail="10" 容器名
Git官网: https://git-scm.com
TortoisGit官网:https://tortoisegit.org
Sourcetree官网:https://www.sourcetreeapp.com/
删除远程仓库的地址
$ git remote rm origin
重置到提交 (恢复到f4df19d提交)
$ git reset --hard f4df19d
重置到远程自己最后一次提交(有可能会抹掉别人的提交)
$ git push origin HEAD --force
取消上一次本地提交(同时清空提交的内容)
$ git reset HEAD~ && git checkout . && git clean -xdf
清除本地提交
$ git reset --hard FETCH_HEAD
清除缓存区所有的内容(不包含本地提交)
$ git checkout . && git clean -xdf添加远程地址(比如远程地址:git@git.kjwoo.cn:bowen/test.git)
$ git remote add origin git@git.kjwoo.cn:bowen/test.git
修改远端地址
$ git remote set-url origin xxx使用yum安装git2.X(wandisco的yum源)
[root@wkjhost ~]# yum install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-1.noarch.rpm
[root@wkjhost ~]# yum install gitgit push到远程分支时报错error: RPC failed; HTTP 411 curl 22 The requested URL returned error: 411 Length Req
git config http.postBuffer 524288000清理本地存储
$ git gc --prune=now
$ git remote prune origin使用合并策略
git config --global pull.rebase true
git config --global branch.autoSetupRebase always
标签
//创建标签
git tag -a 标签名字 -m "标签注释"
//推送所有的分支到远端
git push origin --tags
sourcetree 还原配置
确保SourceTree已关闭。
确保在删除文件之前在以下文件夹中备份文件
删除~/Library/Application Support/SourceTree/
中的所有内容
删除~/Library/Preferences/com.torusknot.SourceTreeNotMAS.plist(您应该使用SourceTree的直接版本,因此“NotMAS”)
#!/bin/bash
#suppor china
yum install wqy-microhei-fonts wqy-zenhei-fonts
#office to pdf
yum install unoconv -y
#pdf to slide image
yum install ImageMagick -y
const unoconv = require('awesome-unoconv');
const fs = require('fs');
const child_process = require("child_process");
class OfficeCovert{
//file to pdf
file2pdf(sourceFile, generateFile){
return unoconv.convert(sourceFile, generateFile);
}
//file to image list
file2images(file, path, prefix = '', suffix ='', ext = 'png'){
return new Promise((resolve, reject)=> {
if(fs.existsSync(file)){
this.rm(path);
this.mkdir(path);
child_process.exec(`convert ${file} ${path}/${prefix}%d${suffix}.${ext} `, (...args) =>{
if(args && args[0] === null){
resolve(path);
}else{
reject(...args);
}
}, err => {
reject(err);
});
}else{
reject('file not found');
}
});
}
//delete file or path
rm(path){
let files = [];
if(fs.existsSync(path)){
if(fs.statSync(path).isDirectory()){
files = fs.readdirSync(path);
files.forEach((file, index)=> {
let curPath = path + '/' + file;
if(fs.statSync(curPath).isDirectory()){
this.rm(curPath);
}else{
fs.unlinkSync(curPath);
}
});
}else{
fs.unlinkSync(path);
}
}
}
//create path
mkdir(path){
if(!fs.existsSync(path)){
fs.mkdir(path,{ recursive: true }, res=> {
if(res){
console.warn(res);
}
});
}
}
}
module.exports = OfficeCovert;
const {resolve} = require('path');
const OfficeCovert = require('./officeCovert');
//定义需要转换的文件
const pptFile = resolve('./office/test2.pptx');
//生成pdf名称
const pdfFile = resolve('./output/test2.ppf');
//设置图片目录
const imgFile = resolve('./output/test2/tst');
const oc = new OfficeCovert();
//geneate pdf
oc.file2pdf(pptFile, pdfFile).then(gFile =>{
//generate image
oc.file2images(gFile, imgFile, 'test11', 'mytest', 'png').then(path=> {
console.log('generate image success !!!!', path);
//clean file
oc.rm(gFile);
}).catch((...args) => {
console.log(args);
});
});
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<script src="https://unpkg.com/rxjs/bundles/rxjs.umd.min.js"></script>
<title>rxjs实现拖拽</title>
<style>
#drag {
width: 200px;
height: 200px;
background-color: yellow;
position: absolute;
cursor: pointer;
}
</style>
</head>
<body>
<div id="drag"></div>
<script src="./rx-drag.js"></script>
</body>
</html>
rx-drag.js
const {
fromEvent,
operators: { map, takeUntil, concatAll, withLatestFrom }
} = rxjs;
const target = document.getElementById("drag");
const mouseDown = fromEvent(target, "mousedown");
const mouseMove = fromEvent(document, "mousemove");
const mouseUp = fromEvent(document, "mouseup");
mouseDown
.pipe(
map(e => {
const { left, top } = e.target.getBoundingClientRect();
const clickOffsetX = e.clientX - left;
const clickOffsetY = e.clientY - top;
return {
clickOffsetX,
clickOffsetY
};
}),
map(({ clickOffsetX, clickOffsetY }) => {
return mouseMove.pipe(
takeUntil(mouseUp),
map(moveEvent => ({
x: moveEvent.clientX - clickOffsetX,
y: moveEvent.clientY - clickOffsetY
}))
);
}),
concatAll()
)
.subscribe(({ x, y }) => {
target.style.left = `${x}px`;
target.style.top = `${y}px`;
});