diff --git a/Miscellaneous/flask.md b/Miscellaneous/flask.md index 2d1648b..9efa764 100644 --- a/Miscellaneous/flask.md +++ b/Miscellaneous/flask.md @@ -85,7 +85,7 @@ autostart = True `gunicorn qrcodeLi:app -c gunicornLi.conf` `gunicorn qrcodeMe:app -c gunicornMe.conf` `gunicorn yiban:app -c gunicorn.conf` -`gunicorn coc:app -c gunicorn.conf` +`gunicorn coc:app -c gunicorn.conf.py` `gunicorn api:app -c gunicorn.conf.py` `gunicorn ccb:app -c gunicorn.conf.py` diff --git a/Miscellaneous/javascript2.md b/Miscellaneous/javascript2.md index c7597e9..1486ad2 100644 --- a/Miscellaneous/javascript2.md +++ b/Miscellaneous/javascript2.md @@ -32,4 +32,38 @@ * 尽量使用for...let,在每次循环中都会声明一个新的变量,生成了一个闭包。避免for里边的函数在调用的时候引用不到正确的变量。 * const声明,相对于保护其中的内容更注重其语意所带来的规范性 * 如果把方法定义在{}内,那么在块外执行会报ReferenceError -* spread/rest`...`放在数组前用于展开数组,放在变量前就是收集变量到一个数组里,例如 `function a(...arg){} a(a,b,c) -> arg = [a,b,c]` \ No newline at end of file +* spread/rest`...`放在数组前用于展开数组,放在变量前就是收集变量到一个数组里,例如 `function a(...arg){} a(a,b,c) -> arg = [a,b,c]` +* 解构 `var [a, b, c] = foo()` 如果foo返回的是一个长度为三的数组其内容将会被依次赋值给abc + * 对象属性复制模式`var {a, b, c} = foo()`这里省略的其实是`a:, b:, c:`,对象的属性名要和函数返回的属性名相同,然后将值一一赋值给属性值`var {a: x, b: y, c: z} = foo()`最后使用的是`xyz`而不是`abc` + * 对于这个形式,如果省略声明符就需要用小括号括起来`({a, b, c} = foo())` + * 对象属性名的计算属性`var which = 'w'; o1 = {which: 'w'}; => {which: 'w'} o2 = {[which]: 'w'}; => {w: 'w'}`使用中括号即可 + * 简单的交换两个元素`[a, b] = [b, a]`' + * 允许出现多次列出同一个源属性`{a: {x: X, x: Y}, a} = {a: {x: 1}} => X == X == 1, a = {x :1}` + * 不必都写在一行里,解构的目的不是为了打字更少,而是为了可读性更强 + * 赋值的时候用不到的东西可以抛弃`[,a,b] = [1, 2, 3] => a = 2, b = 3` + * 赋值的时候多余的东西会赋值undefined`[a, b] = [1] => a = 1, b = undefined` + * 赋值的时候可以使用spread/rest`...`进行收集操作`[...a,b] = [1, 2, 3] => a = [1, 2], b = 3` + * 赋值的时候可以使用默认值`{a, b: WW = 20} = {a: 10} => a = 10, WW = 20` + * 赋值的时候可以嵌套结构 + * 在形参中使用这个就接近了命名参数,得到了任意位置的可选参数功能,设置默认参数`{x = 10} = {}` +* 对象字面量扩展 + * 简洁属性`{x}` + * 简洁方法`{x(){}}` + * 这个操作会生成一个匿名的函数,如果需要递归请不要使用 +* 模板字面量``...${foo(`${name}s`)}`` + ```js + function foo(strings, ...args) { + console.log(strings) + console.log(args) + } + var desc = "awesome" + foo`Every thing is ${desc}!` + // ["Every this is ", "!"] + // ["awesome"] + // 配合Strng.resuce可以用来处理字符串 + ``` +* 箭头函数 + * 合理使用,函数越短越适合用,函数长了反而会使函数边界模糊 + * 主要的功能是为了this的规范化而不是减少代码量 + * 尽可能减少非必要情况下的箭头函数使用 + * \ No newline at end of file diff --git a/Miscellaneous/nginx_pi.conf b/Miscellaneous/nginx_pi.conf index fd1cd0b..6221e50 100644 --- a/Miscellaneous/nginx_pi.conf +++ b/Miscellaneous/nginx_pi.conf @@ -207,4 +207,31 @@ server { access_log off; } access_log /home/pi/data/nginx/logs/pan443.log; +} + +server { + listen 80; + server_name portainer.canary.moe; + return 301 https://portainer.canary.moe$request_uri; + access_log /home/pi/data/nginx/logs/portainer.log; +} + +server { + #SSL 访问端口号为 443 + listen 443 ssl http2; #填写绑定证书的域名 + server_name portainer.canary.moe; + #证书文件名称 + ssl_certificate 1_portainer.canary.moe_bundle.crt; + #私钥文件名称 + ssl_certificate_key 2_portainer.canary.moe.key; + ssl_session_timeout 5m; + #请按照这个协议配置 + ssl_protocols TLSv1.1 TLSv1.2; + add_header Strict-Transport-Security "max-age=31536000"; + ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE; + ssl_prefer_server_ciphers on; + location / { + proxy_pass http://127.0.0.1:5006; + } + access_log /home/pi/data/nginx/logs/portainer443.log; } \ No newline at end of file diff --git a/Miscellaneous/pi.md b/Miscellaneous/pi.md index fe21d09..52c735f 100644 --- a/Miscellaneous/pi.md +++ b/Miscellaneous/pi.md @@ -310,6 +310,7 @@ sudo chmod -R g+rwx /home/pi/data/owncloud sudo -u www-data ls -la /home/pi/data/owncloud sudo chown -R www-data:www-data /home/pi/data/owncloud +sudo chown -R www-data:www-data /home/pi/data/owncloud/data/canary/files/Photos/animation/0 wget https://download.owncloud.org/community/owncloud-10.3.2.tar.bz2 diff --git a/Miscellaneous/test.js b/Miscellaneous/test.js new file mode 100644 index 0000000..e9c268c --- /dev/null +++ b/Miscellaneous/test.js @@ -0,0 +1,4 @@ +var o = [1, 2, 3] +var a, b, c, p +p = {a, b, c} = o +console.log(a, b, c, p) \ No newline at end of file