WishMeLz

生活其实很有趣

Node接口笔记

JTW 生成TOKEN let token = jsonwebtoken.sign({ id: data[0].id // 数据 }, secret, { expiresIn: 60 * 60 * 24 * 30 * 6 }) // 半年,过期时间 ,单位秒 secret为秘钥 解析 try { // 解析令牌,返回对象:{ exp: 过期时间, crt:创建时间 ...} userInfo = jwt.ve...

Centos安装Nginx

# 依赖 yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel # 下载安装包 wget http://nginx.org/download/nginx-1.13.7.tar.gz # 解压 tar -xvf # 进入运行文件 ./configure # 运行编译 make # 安装 make install nginx reload 重启 service nginx restart nginx -t 验证配置文件# 一份模板,不完整 worker_proc...

Nodejs,Mysql连接出错

const connection = mysql.createConnection(db)长时间不操作mysql,会自动关闭连接,导致服务中断。修改为:使用连接池const connection = mysql.createPool(db)const mysql = require('mysql'); const config = require('./config') const conn = mysql.createPool(config.db); var queryDB = func...

speedtest-cli测试带宽

# wget https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py # chmod +rx speedtest.py # sudo mv speedtest.py /usr/local/bin/speedtest-cli # sudo chown root:root /usr/local/bin/speedtest-cli speedtest-cli --bytes以字节计算的方式来测试上下行速度 speedtest-cli --share将速度测试的结...

使用request后台发送请求

处理有跨域的接口。后台调用const request = require('request'); router.get("/wnl", (req, res) => { request('https://www.sojson.com/open/api/lunar/json.shtml', function(error, response, body) { if (!error && response.statusCode == 200) { console.log(body) // S...

阿里大鱼发送短信

// 配置 const Core = require('@alicloud/pop-core'); var client = new Core({ accessKeyId: '****', // id accessKeySecret: '***', // 密钥 endpoint: 'https://dysmsapi.aliyuncs.com', apiVersion: '2017-05-25' }); // 用户模板信息 var params = { "RegionId": "cn-han...

阿里OSS存储

nodejs发送文件到public内,调用oss接口上传文件。 <input type="file" name="" id="photo"> $("#photo").on("change", function () { let file = $(this)[0].files[0]; let formdata = new FormData(); formdata.append("photo", file); $.ajax({ typ...

一段神奇的代码

alert((++[[]][+[]]/[]+[])[+[]]+([{}]+[])[++[[]][+[]]+[+[]]-+!+[]-+!+[]-+!+[]]+(![]+[])[!+[]+!+[]]+([{}]+[])[+!+[]]+'v'+(-{}+[]+[]+[][+[]])[+!+[]+[+[]]]+([{}]+[])[++[[]][+[]]+[+[]]-+!+[]-+!+[]-+!+[]]+(++[[]][+[]]/[]+[])[+!+[]+[+[]]-!+[]-!+[]-!+[]]+([{}]+[])[+!+[]]+([][[]]+[])[+...

Nodejs流

const fs = require("fs")// 创建写入流,就是先创建个文件。这个文件是空的。let ws = fs.createWriteStream('./public/upload/' + fileName); 写入数据 这里是二进制数据ws.write(req.file.buffer);  监听打开ws.on("open",function(fd){     console.log("文件正在打开",fd)...

项目树状图展示

npm install -g tree-cli treee -l 2 -o out.md --ignore [node_modules,config.js,package-lock.json,package.json]

nodejs发送邮件

开启QQ邮箱的SMTP服务// 安装npm install nodemailer --save var nodemailer = require('nodemailer'); var transporter = nodemailer.createTransport({ service: 'qq', port: 465, // SMTP 端口 secureConnection: true, // 使用 SSL auth: { // 你的smtp账号 user: '**********',...

3D旋转相册

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> <link type="text/css" href="https://itsse.oss-cn-shanghai.aliyuncs.com/lib/chaos/3DpotoAlbum.css" rel="stylesheet" /> <script src="https://itsse.oss-cn-shanghai.aliyuncs....

记录跨域一些资料

node简单服务器apicors包设置请求头方法header("Access-Control-Allow-Origin: *"); // 允许任意域名发起的跨域请求 header('Access-Control-Allow-Headers: X-Requested-With,X_Requested_With');Vue中psot请求后台node接收不到参数 let pars = new URLSearchParams(); pars.append("user","yhm"); this.$axios.post("/...

各浏览器的用户代理字符串整理

1. IE 和 IE Mobile 浏览器WindowsIE 9Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)WindowsIE 10Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)WindowsIE 11Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like GeckoWindows PhoneIE 10M...

记录几个国内学生服务器

阿里云https://promotion.aliyun.com/ntms/act/campus2018.html?spm=a2c4g.11186623.2.10.60c44e6b7edPoK腾讯云https://cloud.tencent.com/act/campus?fromSource=gwzcw.1293314.1293314.1293314&cps_key=926cbf665559b546f00b6d68613668ee华为云https://developer.huaweicloud.com/campus?productType=e...

PHP获取QQ用户信息接口

<?php header("Access-Control-Allow-Origin: *"); // 允许任意域名发起的跨域请求 header('Access-Control-Allow-Headers: X-Requested-With,X_Requested_With'); //获取QQ昵称QQ头像 if ($_GET['qq']) { $qq = $_GET['qq']; //向接口发起请求获取json数据 $get_info = file_get_contents('http://r.qzone.qq.com...

Mysql操作

远程链接 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'a123456!' WITH GRANT OPTION; 修改密码SET PASSWORD = PASSWORD('Abc123!_'); 命令立即生效 flush privileges; 启动service mysqld start   查看位置which mysql查看配置文件位置mysql --help | grep 'Default options' -A 1重置密码skip-grant-tablesserv...

工具收集

油管视频提取https://www.clipconverter.cc/ copy链接 回车宽带测速https://www.speedtest.net/ 国外的域名站https://www.freenom.com