js 批量打包下载图片一例

<script src="./js/jszip.min.js"></script>
<script src="./js/FileSaver.min.js"></script>
<script src="./jquery/2.1.3/js/jquery.min.js"></script>
<script>
    var zip = new JSZip();
    zip.file("Hello.txt", "Hello World\n");
    var img = zip.folder("images");
    img.file("1.png", getBase64("https://www.baidu.com/img/bd_logo1.png"), {base64: true});
    zip.generateAsync({type: "blob"})
        .then(function (content) {
            // see FileSaver.js
            saveAs(content, "example.zip");
        });


    //传入图片路径,返回base64
    function getBase64(img) {
        function getBase64Image(img, width, height) {//width、height调用时传入具体像素值,控制大小 ,不传则默认图像大小
            var canvas = document.createElement("canvas");
            canvas.width = width ? width : img.width;
            canvas.height = height ? height : img.height;

            var ctx = canvas.getContext("2d");
            ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
            var dataURL = canvas.toDataURL();
            var arr = dataURL.split(",");
            return arr[1];
        }

        var image = new Image();
        image.crossOrigin = 'Anonymous';
        image.src = img;
        var deferred = $.Deferred();
        if (img) {
            image.onload = function () {
                deferred.resolve(getBase64Image(image));//将base64传给done上传处理
            }
            return deferred.promise();//问题要让onload完成后再return sessionStorage['imgTest']
        }
    }
</script>

LVM ext4缩容

缩减逻辑卷,xfs不支持,缩减前先unmount

e2fsck -f /dev/vg1/lv1 #检查磁盘错误 (针对ext4执行)
resize2fs /dev/vg1/lv1 100M #更新逻辑卷信息(针对ext4执行)
lvresize -L 100M /dev/vg1/lv1 #重新设定大小

作者:pcct
来源:CSDN
原文:https://blog.csdn.net/lovektm/article/details/78461453
版权声明:本文为博主原创文章,转载请附上博文链接!

学习下

#include <stdio.h>

void pass(){
    int a=0;
    int *p=&a;
    while(1){
        if(*p==123)
            break;
        p++;
    }
    *p=456;
}

int main(){
    int x=123;
    pass();
    printf("%d\n",x);
    return 0;
}

杨龙

2018年10月20日

刚刚yum安装MySQL 8.0,直接把我的mariadb卸载了