wzhanjun / blog Goto Github PK
View Code? Open in Web Editor NEWmy person notes
my person notes
$(document).on("click", "#toolbar .btn-del-multi", function () {
var that = this;
var ids = Table.api.selectedids(table);
layer.confirm(
__('确定删除选中的 %s 项吗?', ids.length),
{icon: 3, title: __('Warning'), offset: 0, shadeClose: true},
function (index) {
Fast.api.ajax({
url: $.fn.bootstrapTable.defaults.extend.multi_del_url,
data: {ids: ids.join(',')}
}, function (data, ret) {
Toastr.success("操作成功");
$(".btn-refresh").trigger("click");
return false;
}, function (data, ret) {
Toastr.error(ret.msg);
return false;
});
layer.close(index);
}
);
});
sed -i "s@http://(deb|security).debian.org@https://mirrors.xxx.com@g" /etc/apt/sources.list
https://mirrors.aliyun.com/debian/
https://mirrors.tencent.com/debian/
wget https://curl.haxx.se/ca/cacert.pem
curl.cainfo="/etc/php7.0/cacert.pem"
openssl.cafile="/etc/php7.0/cacert.pem"
$objPHPExcel = new PHPExcel();
// Set Orientation, size and scaling
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT);
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
$objPHPExcel->getActiveSheet()->getPageSetup()->setFitToPage(true);
$objPHPExcel->getActiveSheet()->getPageSetup()->setFitToWidth(1);
$objPHPExcel->getActiveSheet()->getPageSetup()->setFitToHeight(0);
// Generate spreadsheet
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
参考:
http://www.craiglotter.co.za/2010/04/18/setting-your-worksheet-printing-layout-options-in-phpexcel/
// m3u8
ffmpeg -i playlist.m3u8 -vcodec copy -acodec copy -absf aac_adtstoasc out.mp4
// ffmpeg m3u8 转mp4
ffmpeg -i playlist.m3u8 -c copy output.mp4
// 从第10s 开始截取
ffmpeg -ss 10 -i playlist.m3u8 -c copy 00003.mp4
// 截取前10s
ffmpeg -i playlist.m3u8 -c copy -t 10 00004.mp4
// 转换视频的分辨率 640:360
ffmpeg -i video_1920.mp4 -vf scale=640:360 video_640.mp4 -hide_banner
// 转换分辨率 同时设置视频的宽高比
ffmpeg -i video_1920.mp4 -vf scale=640:480,setdar=4:3 video_640x480.mp4 -hide_banner
// ffmpeg 转mp3
ffmpeg -i 52a8b8ccded5ddb4c40bf350dff089aa2ad2efe6_v1.mp4 -f mp3 -vn 522.mp3
// ffmpeg 抽取音频
ffmpeg -i 3.mp4 -vn -y -acodec copy 3.aac
MATCH (m1:member),(m2:member),
p = shortestPath((m1)-[:Invite*]-(m2))
WHERE (m1.uid) = 100000 AND (m2.uid) = 10133947
return p
# CentOS系统 用这个
yum install -y ca-certificates
# Debian/Ubuntu系统 用这个
apt-get install -y ca-certificates
cd repo.git
git bundle create ./reponame.bundle --all
git clone ./reponame.bundle reponame
git clone -b release ./reponame.bundle reponame
git remote rm origin
git remote add origin newrepo.git
在 NGINX Server 修改如下
networks:
frontend:
aliases:
- you_site
backend:
aliases:
- you_site
切换到 laradock 中
docker-compose stop nginx
docker-compose build --no-cache nginx
docker-compose up -d nginx
function getWeekNumber(d) {
// Copy date so don't modify original
d = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()));
// Set to nearest Thursday: current date + 4 - current day number
// Make Sunday's day number 7
d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay()||7));
// Get first day of year
var yearStart = new Date(Date.UTC(d.getUTCFullYear(),0,1));
// Calculate full weeks to nearest Thursday
var weekNo = Math.ceil(( ( (d - yearStart) / 86400000) + 1)/7);
// Return array of year and week number
return [d.getUTCFullYear(), weekNo];
}
Date.prototype.format = function(fmt) {
var o = {
"M+" : this.getMonth()+1, //月份
"d+" : this.getDate(), //日
"h+" : this.getHours(), //小时
"m+" : this.getMinutes(), //分
"s+" : this.getSeconds(), //秒
"q+" : Math.floor((this.getMonth()+3)/3), //季度
"S" : this.getMilliseconds() //毫秒
};
if(/(y+)/.test(fmt)) {
fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
}
for(var k in o) {
if(new RegExp("("+ k +")").test(fmt)){
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
}
}
return fmt;
}
function getDateOfISOWeek(w, y) {
var simple = new Date(y, 0, 1 + (w - 1) * 7);
var dow = simple.getDay();
var ISOweekStart = simple;
if (dow <= 4)
ISOweekStart.setDate(simple.getDate() - simple.getDay() + 1);
else
ISOweekStart.setDate(simple.getDate() + 8 - simple.getDay());
return ISOweekStart.format("yyyy-MM-dd");
}
Chrome 浏览器,地址栏输入并回车:chrome://flags/#enable-parallel-downloading
Edge 新版浏览器,地址栏输入并回车:edge://flags/#enable-parallel-downloading
table.on('post-body.bs.table', function (e, settings, json, xhr) {
$(".btn-edit").data("end", function(){
$('.btn-refresh').trigger("click");
});
});
https://goaccess.io/get-started
$ wget http://tar.goaccess.io/goaccess-1.2.tar.gz
$ tar -xzvf goaccess-1.2.tar.gz
$ cd goaccess-1.2/
# --with-openssl项开启openssl,HTTPS时需要
$ ./configure --enable-utf8 --enable-geoip=legacy --with-openssl
$ make
$ make install
[配置](https://goaccess.io/faq#configuration)
time-format %H:%M:%S
date-format %d/%b/%Y
log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u"
F1 主帮助页面
F5 重绘主窗口
q 退出
1-15 跳转到对应编号的模块位置
o 打开当前模块的详细视图
j 当前模块向下滚动
k 当前模块向上滚动
s 对模块排序
/ 在所有模块中搜索匹配
n 查找下一个出现的位置
g 移动到第一个模块顶部
G 移动到最后一个模块底部
goaccess access.log --log-format=COMBINED
goaccess -f access.log -o output.html
https://segmentfault.com/a/1190000016383026
https://ericdraken.com/goaccess-web-log-analyzer-installation-centos/
ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa <<< y
git config --global color.ui true
git config --global core.editor vim
git tag | grep "v" |xargs git tag -d
git diff --cached
git diff --staged
git status -s
git log --name-status 每次修改的文件列表, 显示状态
git log --name-only 每次修改的文件列表
git log --stat 每次修改的文件列表, 及文件修改的统计
git whatchanged 每次修改的文件列表
git whatchanged --stat 每次修改的文件列表, 及文件修改的统计
git show 显示最后一次的文件改变的具体内容
git show -5 显示最后 5 次的文件改变的具体内容
git show commitid 显示某个 commitid 改变的具体内容
# 查看清理分支
git remote prune origin --dry-run
# 清理分支
git remote prune origin
# 忽略文件
git update-index --assume-unchanged
# 取消忽略
git update-index —no-assume-unchanged
# 查看忽略
git ls-files -v| grep '^h\ '
## 跳过工作树
git update-index --skip-worktree $filename
## 取消跳过工作树
git update-index --no-skip-worktree path
## 查看 跳过工作树
git ls-files -v | grep -i ^S
1 编写一个注册表修改文件,名为:fastkey.reg,内容:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"AutoRun"="%USERPROFILE%\fastkey.bat"
查看docker中存在的网络:
docker network ls
查看bridge网络的详细配置:
docker network inspect bridge
创建了一个名为"my-net"的网络
docker network create my-net
将Web服务加入my-net网络中
docker network connect my-net test_demo
断开容器与docker0的连接
docker network disconnect bridge test_demo
// 添加过滤
Plupload.addFileFilter('width_height', function(data, file, cb) {
var self = this, img = new moxie.image.Image();
function finalize(result) {
// cleanup
img && img.destroy();
img = null;
// if rule has been violated in one way or another, trigger an error
if (!result) {
self.trigger('Error', {
code : Plupload.IMAGE_DIMENSIONS_ERROR,
message : "图片尺寸不一致, 尺寸要求, 宽:" + data.width + "px, 高: " + data.height + " px.",
file : file
});
}
cb(result);
}
img.onload = function() {
// check if resolution cap is not exceeded
console.log("image:", img.width, img.height, "data:", data)
var result = true;
if (data.width > 0 && data.height > 0) {
result = (img.width == data.width) && (img.height == data.height)
}
finalize(result);
};
img.onerror = function() {
finalize(false);
};
img.load(file.getSource());
});
参考:
https://chaping.github.io/plupload/doc/#plupload_doc2
https://www.coder.work/article/2253194
https://blog.sylingd.com/archives/271.html
create user zhangsan identified by 'zhangsan';
grant all privileges on zhangsanDb.* to zhangsan@'%' identified by 'zhangsan';
flush privileges;
mysql> CREATE USER back_user IDENTIFIED BY '123456';
mysql> GRANT SELECT,RELOAD,SHOW DATABASES,LOCK TABLES,EVENT,REPLICATION CLIENT ON *.* TO 'back_user'@'192.168.0.203' IDENTIFIED BY '123456';
mysql> FLUSH PRIVILEGES;
1、首先查看nginx的error日志,会有报错提示,类似:nginx的目录明下的文件 failed(13: Permission denied) while reading upstream, client:...,server
2、看报错提示是没有权限,原因就是nginx存在一个buffer的机制,在数据过大超出缓冲区的最大容量,会将数据写入临时文件(临时目录),而此时如果你安装的nginx的用户权限不是服务器权限,就会报没有权限的问题,因为此时没有权限,所以再返回时,超出缓冲区的数据将丢失,就会出现截断。
3、最后将nginx的目录赋予权限就可以了
4、执行操作:
sudo chown -R www:root nginx目录名称
chmod -R 764 /usr/local/nginx/临时目录名称
fastcgi_buffer 8 128;此处代表nginx设置8个128k的块进行缓存,总共大小是8*128k
fastcgi_buffer_size 128k; 此处代表每块大小,用于指定读取fastcgi应答第一部分需要用多大的缓冲区,这个值表示将使用1个128kb的缓冲区读取应答的一部分(应答头),可以设置为fastcgi_buffers选项指定的缓冲区大小。
fastcgi_buffers : 指定本地需要用多少和多大的缓冲区来缓冲FastCGI的应答请求。如果一个PHP脚本所产生的页面大小为256KB,那么会为其分配4个64KB的缓冲区来缓存;如果页面大小大于256KB,那么大于256KB的部分会缓存到fastcgi_temp指定的路径中,但是这并不是好方法,因为内存中的数据处理速度要快于硬盘。一般这个值应该为站点中PHP脚本所产生的页面大小的中间值,如果站点大部分脚本所产生的页面大小为256KB,那么可以把这个值设置为“16 16k”、“4 64k”等。
参考:
https://www.codenong.com/cs106772846/
https://segmentfault.com/a/1190000007513677
const qrcode = new QRCode(document.createElement('div'), {
text: "http://jindo.dev.naver.com/collie",
width: 128,
height: 128,
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.H
});
qrcode._oDrawing._elImage.onload = ev => {
console.log(ev.target.src);
}
目前交易所的以太坊代币的方案是这样的:
1、给每一个账号分配一个唯一的以太坊钱包地址
2、用户充币往分配给他们的钱包中转币,设置监控程序,检测到他们的钱包有入账记录就给账号中增加响应的充值金额
3、用户提币:用户提交提币申请然后进行扣币,后台通过一个指定钱包地址(称为主钱包)向用户的提币钱包中转账
ssh-keygen -f xxx #生成指定的文件名xxx
ssh-copy-id -i .ssh/id_rsa.pub [email protected]
.ssh 目录新增/编辑 config文件
HOST name
HostName 192.168.x.xxx
IdentityFile ~/.ssh/xxx
RUN pecl install mongodb \
&& echo "extension=mongodb.so" > /usr/local/etc/php/conf.d/mongo.ini
注:需先安装openssl
apt-get install libssl-dev
yum install -y openssl openssl-devel
RUN apt-get update && apt-get install -y libpng-dev
RUN apt-get install -y \
libwebp-dev \
libjpeg62-turbo-dev \
libpng-dev libxpm-dev \
libfreetype6-dev
RUN docker-php-ext-configure gd \
--with-gd \
--with-webp-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-xpm-dir \
--with-freetype-dir
RUN docker-php-ext-install gd
遇到php-fpm:7.2版本gd库一直没有安装freetype
show global variables like 'max_allowed_packet';
set global max_allowed_packet=1024*1024*16;
修改my.cnf
max_allowed_packet = 16M
编辑文件时readonly
:w !sudo tee %
在文件插入当前路径
:r !pwd
fetch('https://jsonplaceholder.typicode.com/todos/1')
.then(resp => resp.blob())
.then(blob => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
// the filename you want
a.download = 'todo-1.json';
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
alert('your file has downloaded!'); // or you know, something with better UX...
})
.catch(() => alert('oh no!'));
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
<button onclick="GetFile()">下载</button>
<script>
// 会先下载流,完成后才弹出选择目录,所以最好加上进度条
function GetFile(){
axios({
url: `http://image.wangrui8.top/dms-2019-07-22-00-00~1.mp4`,
method: 'get',
responseType: 'blob',
onDownloadProgress (progress){
// 这里是下载的进度
console.log(Math.round(progress.loaded / progress.total * 100) + '%');
},
})
.then(res=>{
let blobUrl = window.URL.createObjectURL(res.data);
let link = document.createElement('a');
document.body.appendChild(link);
link.href = blobUrl;
link.download = '下载文件.mp4';
link.click();
window.URL.revokeObjectURL(blobUrl);
})
}
</script>
</body>
</html>
参考:
https://stackoverflow.com/questions/3749231/download-file-using-javascript-jquery
https://my.oschina.net/u/4342183/blog/3419827
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
location ~ .*\.(php|php5)(.*)?$ {
fastcgi_pass php-fpm:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
https://www.qiancheng.me/post/coding/show-linux-issue-version
sudo env PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install --no-bin-links
'./configure' '--prefix=/usr/local/php73' '--with-config-file-path=/usr/local/php73/etc' '--with-config-file-scan-dir=/usr/local/php73/etc/php.d' '--with-fpm-user=www' '--with-fpm-group=www' '--enable-fpm' '--enable-opcache' '--disable-fileinfo' '--enable-mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-iconv-dir=/usr/local' '--with-freetype-dir' '--with-jpeg-dir' '--with-png-dir' '--with-zlib' '--with-libxml-dir=/usr' '--enable-xml' '--disable-rpath' '--enable-bcmath' '--enable-shmop' '--enable-exif' '--enable-sysvsem' '--with-curl' '--enable-mbregex' '--enable-inline-optimization' '--enable-mbstring' '--with-mcrypt' '--with-gd' '--enable-gd-native-ttf' '--with-openssl' '--with-mhash' '--enable-pcntl' '--enable-sockets' '--with-xmlrpc' '--enable-ftp' '--enable-intl' '--with-xsl' '--with-gettext' '--enable-zip' '--enable-soap' '--disable-ipv6' '--disable-debug'
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<style> html,body{ height:100%; width:100%; padding:0; margin:0; } #content{ width:90%; height:100%; padding:0; margin:10px auto; } </style>
</head>
<body>
#CONTENT
</body>
<script> var imgs = document.getElementsByTagName('img'); for(var i in imgs) { var img = imgs[i]; img.style.width='100%'; img.style.height='auto'; } </script>
</html>
[参考]
https://blog.csdn.net/xm393392625/article/details/88217958
## 模糊查询
db.getCollection("tencent_group_message").find({"msg_body.MsgContent.Text": /red/});
## 右侧模糊 xx%
db.getCollection("tencent_group_message").find({"msg_body.MsgContent.Text": /^red/});
## 不区分大小写
db.getCollection("tencent_group_message").find({"msg_body.MsgContent.Text": /red/i});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.