WishMeLz

生活其实很有趣

TgBot

先去@BotFather创建一个机器人,具体步骤谷歌,拿到TOKENnpm i node-telegram-bot-apiconst token = "XXXXXXX"; const TelegramBot = require('node-telegram-bot-api'); const bot = new TelegramBot(token, {polling: true}); //监听信息 bot.on('message', (msg) => { //处理函数 // msg.chat.id 相当于用户ID ...

1900年至2100年公历、农历互转Js代码

/**公历年月日转农历数据 返回json**/ calendar.solar2lunar(2000,8,23); /**农历年月日转公历年月日**/ calendar.lunar2solar(2000,7,24);Animal: "龙" IDayCn: "廿四" IMonthCn: "七月" Term: "处暑" astro: "处女座" cDay: 23 cMonth: 8 cYear: 2000 gzDay: "癸丑" gzMonth: "甲申" gzYear: "庚辰" isLeap: false isTerm: true isToday: ...

Flutter 第一次启动安卓报错

Running Gradle task 'assembleDebug'... Exception in thread "main" javax.net.ssl.SSLException: Connection reset at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:127) at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:326) at java.base...

NodeJs安装

wget http://ossfp.oss-cn-beijing.aliyuncs.com/1620366384005.xztar -xvf 1620366384005.xz mv node-v12.11.1-linux-x64 nodejsln -s /app/nodejs/bin/node /usr/local/bin/ ln -s /app/nodejs/bin/npm /usr/local/bin/ ln -s /app/nodejs/bin/pm2 /usr/local/bin/#!/bin/sh cd / mkdir app cd /a...

个人收款免签约

这个软件叫做“双卡助手”,是一个监听手机短信、应用通知的软件,他可以将你手机的短信、应用通知等信息进行转发,可以转发到邮箱,公众号,甚至是手机号,还可以转发给服务器。我们只需要使用他这个特性,将收到的微信支付通知,转发给服务器。软件软件: https://www.coolapk.com/apk/com.cozylife.smshelper2021/5/6备份:app-release-176517-o_1f3mfcmeqboi1ogbrm91j7u1luc10-uid-855054.apk设置BODY的格式{"title":"{{title}}","...

gravatar全球通用头像

 https://cn.gravatar.com/avatar/4c6e391ddde7dae7d9ebf03bb584c064?s=73&d=retro这里需要一个哈希值来确定头像的唯一性, 通过MD5加密就可以.s是尺寸, d是类型对应如下 .item { display: flex; align-items: center; margin-top: 20px; } .item img { margin-right: 12px;margin-left...

微信机器人

https://github.com/padlocal/wechaty-puppet-padlocal/wiki/TOKEN-%E7%94%B3%E8%AF%B7%E6%96%B9%E6%B3%95app.tsimport { PuppetPadlocal } from "wechaty-puppet-padlocal"; import { Contact, log, Message, ScanStatus, Wechaty, Friendship } from "wechaty"; const puppet = new PuppetPadloc...

Centos 6 yum 错误

Error: All mirror URLs are not using ftp, http[s] or file. Eg. Invalid release/repo/archcd /etc/yum.repos.d/ 修改 CentOS-Base.repo注释掉 mirrorlist= 开头的注释取消 baseurl 开头的注释将 baseurl 中的mirrorlist.centos.org 改为 vault.centos.org

阿里STS权限管理

打开地址  https://ram.console.aliyun.com/roles创建用户来获取 accessKeyId accessKeySecretRAM角色管理,创建RAM角色,选择阿里云给角色添加权限,可以添加无数个,最重要的是添加AliyunSTSAssumeRoleAccesslet OSS = require('ali-oss'); let STS = OSS.STS; let sts = new STS({ accessKeyId: 'LTAI5*******e4eSf', ...

MySql拿到插入的ID

场景:插入一条数据,这条数据的ID是自增的主键.需要在插入的时候拿到这个IDnpm i mysql conn.query(sql,(err,data)=>{ console.log(data.insertId) })

Nginx分流

server { listen 443 ssl; server_name api.xxx.com; # index index.html index.htm index.php; # root /aweb/api; ssl_certificate cert/api.pem; ssl_certificate_key cert/api.key; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HI...

NodeJs抓取页面

npm i cheerio request iconv-lite思路:通过 request 获取到页面。在使用 iconv-lite 编译数据。在使用 cheerio 拿到对应的元素。这里以抓取微博热搜为例const cheerio = require('cheerio'); const request = require('request'); const iconv = require('iconv-lite'); function http(url, decode = 'utf8') { return new Promise((res...

NodeJs抓取页面内容

const cheerio = require('cheerio'); const request = require('request'); let url = 'https://btc.com/' request({ url: url, encoding: null }, function (error, response, body) { if (!error && response.statusCode == 200) { var buf = iconv.decode(body...

随机数

function getRandom(start, end, fixed = 0) { let differ = end - start let random = Math.random() return (start + differ * random).toFixed(fixed) }getRandom(1,5) 1<= num >=5

H5打电话发短信

<meta name="format-detection" content="telephone=yes"/> <a href="tel:13660007710">13660007710</a> <a href="sms:13660007710">13660007710</a>

保存图片文件,下载图片

function downloadIamge(imgsrc, name) { //下载图片地址和图片名 let image = new Image(); // 解决跨域 Canvas 污染问题 image.setAttribute("crossOrigin", "anonymous"); image.onload = function () { let canvas = document.createElement("canvas"); ...