Skip to content

Instantly share code, notes, and snippets.

View xiaoyuze88's full-sized avatar

Xiao Yuze xiaoyuze88

  • Tencent
  • Shenzhen, China
View GitHub Profile
@longbill
longbill / wxcrypto.js
Last active March 4, 2022 08:43
微信公众号消息加密解密nodejs模块
const crypto = require('crypto');
const debug = require('debug')('wxcrypto');
/**
* 微信公众号消息加密解密,支持 node > 8.0
*
* var WXCrypto = require('this module');
* var wx = new WXCrypto(token, aesKey, appid);
*
* var [err, encryptedXML] = wx.encrypt(xml, timestamp, nonce);
@ygotthilf
ygotthilf / jwtRS256.sh
Last active May 6, 2024 08:48
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@imjasonh
imjasonh / markdown.css
Last active February 12, 2024 17:18
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions