Skip to content

Instantly share code, notes, and snippets.

View tedyyu's full-sized avatar

Tedy tedyyu

  • Shanghai
View GitHub Profile
@tedyyu
tedyyu / sendGridExample.ts
Created January 10, 2024 00:26
sendgrid/mail typescript example
import sgMail from '@sendgrid/mail'
async function sendMail(email: string, content: string, subject: string): Promise<void> {
// using Twilio SendGrid's v3 Node.js Library
// https://github.com/sendgrid/sendgrid-nodejs
sgMail.setApiKey('<sendGridApiKey>');
const msg = {
to: email, // Change to your recipient
from: 'sender@yourmail.com', // Change to your verified sender
@tedyyu
tedyyu / ESTypeScriptExampleOfCallingAlicloudDirectMailJSSDK.ts
Last active January 8, 2024 08:05
How to call AliCloud's DirectMail JS SDK in your TypeScript ES project
//Here is a rescue if you meet "TypeError: Dm20151123 is not a constructor" or similar errors when calling Alicloud DirectMail JS SDK in your TypeScript with ES module project
//https://api.alibabacloud.com/api-tools/sdk/Dm?version=2015-11-23&language=nodejs-tea&tab=primer-doc
//It seems SDK uses commonjs (CJS) module only
//So the fix is to build a wrapper using TypeScript CJS, and call it from your TypeScript ES project
//here is an example
//如果在TypeScript with ES模块项目中调用阿里云DirectMail JS SDK时遇到“TypeError: Dm20151123 is not a constructor”或类似错误,这里有一个救援方法
//https://api.alibabacloud.com/api-tools/sdk/Dm?version=2015-11-23&language=nodejs-tea&tab=primer-doc
//看来SDK只使用了commonjs (CJS)模块
//因此解决方法是使用 TypeScript CJS 构建一个包装器(Wrapper),并从 TypeScript ES 项目中调用它
AxImp Error: API restriction: The assembly '' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.
If you met this, check the path specified in /rcw: is an absolute file path instead of relative one, e.g.
cd c:\code\app
aximp.exe ..\bin\rtsxdlg.dll /rcw:C:\code\bin\Interop.MyOcx.dll /out:..\bin\AxInterop.MyOcx.dll /keyfile:mykey.snk /ignoreregisteredocx /verbose
will work,
compared to the following
@tedyyu
tedyyu / gist:711c45fa3b2dcf478945e01d16580184
Created June 1, 2021 07:07
实战如何让百度网盘突破下载速度
谁家宽带不是一两百兆(bit/s),百度网盘故意限速30KB/s甚至更低,还时不时下载失败,干扰正常使用。花钱开通他家超级会员才是家里带宽下正常下载速度(十来兆每秒)!How Evil!
百度网盘Mac应用里普通用户下载速度
作为一个技术宅,怎么可以坐得住呢?于是Chrome+开发者模式看了一圈,看得到一些verify账号密码的HTTP请求响应,但由于streaming和下载还是不一样的,服务端和客户端js里的协同处理过于复杂,搞的没有脾气,放弃。
后来跳出框框,想到专门负责下载的百度网盘应用会不会简单点,Next show me the way~
下载Wireshark,侦听一会数据包,一堆TCP收发,首先得找到当前下载源的百度服务器IP(会有多个,每次都需要自己挖),这个有很多办法,我偷懒在mac的活动管理器里找到“百度网盘”,在其打开的文件和端口tab里,会展示这么一行:
192.168.3.39:55191->117.34.84.21:http