订阅
#1365 | 2024-11-18 15:48:53

又学到一招,GitHub提供某个pull的patch下载,构造链接方式为 https://patch-diff.githubusercontent.com/raw/username/reponame/pull/ID.patch

比如这个pull的补丁文件下载链接为https://patch-diff.githubusercontent.com/raw/iwestlin/lab/pull/1.patch

(来自 https://github.com/iwestlin/lab/pull/1.patch的重定向

#1362 | 2024-11-08 10:37:35

一行代码获取抖音网页视频源地址:

[...document.querySelector('.xgplayer video').childNodes].pop().src
#1358 | 2024-10-01 04:56:37

冒出一个idea,理论上现在的科技完全可以做到:「象棋AR眼镜」

带上这种眼镜以后,只要视野内出现类似棋盘的图像,就会激活特定的图像识别系统,将盘面转化为标准棋谱格式,然后调用类似皮卡鱼这种象棋引擎,算出红黑方各自的最佳招之后(因为图片无法确定接下来是谁走棋),再绘制到眼镜中棋盘所在的视野中。

感觉要是实现出来的话,至少能做成产品大卖的,不比什么苹果vr酷炫多了😅

#1357 | 2024-09-23 17:15:15

https://blog.glyphdrawing.club/font-with-built-in-syntax-highlighting/

#1356 | 2024-08-13 09:32:02

https://platform.deepseek.com/api-docs/zh-cn/function_calling/

#1354 | 2024-07-02 00:55:57

pipe.js:

process.stdout.write(require('fs').readFileSync(0, 'utf-8'))
// or process.stdin.pipe(process.stdout)
script -q /dev/null node -p  "Boolean(0)" | node pipe.js
# will print yellow false

#1353 | 2024-06-30 02:11:36

https://stablediffusion3.net/zh-CN

#1351 | 2024-05-07 18:28:34

啥叫递归啊

#1348 | 2024-04-21 12:39:03

url to text(for llm

#1345 | 2024-04-10 09:20:39
#1339 | 2024-04-02 20:02:22

我才知道娜塔丽波特曼是犹太人……还有她今年离婚了。。😅

=== update ===

才注意到原来费曼也是犹太人😭

#1337 | 2024-03-25 19:53:31
let a = await (Promise.reject('msg')).catch(e => e)
a === 'msg' // true

(但如果把await放到括号里面就catch不住了🙅‍♀️

#1335 | 2024-03-20 15:18:56

node从v18起就支持把JS代码打包成二进制了:https://nodejs.org/api/single-executable-applications.html

(我记得好像记录过这个,但是找不到了...😅😅

#1334 | 2024-03-20 13:10:46

成功用workerd把gdshare在vps上跑起来了

docker pull dcard/workerd

docker run -d -p 8081:8081 -v .:/app dcard/workerd serve /app/workerd.capnp

第二条命令执行的时候要确保当前目录有两个文件,一个是workerd.capnp:

using Workerd = import "/workerd/workerd.capnp";

const helloWorldExample :Workerd.Config = (
  services = [ (name = "main", worker = .helloWorld) ],
    sockets = [ ( name = "http", address = "*:8081", http = (), service = "main" ) ]
);

const helloWorld :Workerd.Worker = (
  serviceWorkerScript = embed "worker.js",
  compatibilityDate = "2023-02-28",
);

另一个是worker.js

addEventListener('fetch', event => {
  event.respondWith(handle(event.request));
});

async function handle(request) {
  return new Response("Hello World\n");
}

(实际上我是用了gdshare

其实不一定要用docker,我本地迷你主机就成功用官方发布的二进制的workerd跑起来了,但是我的vps ubuntu版本比较老,直接跑二进制会报错……

具体命令则是 ./workerd serve workerd.capnp

#1330 | 2024-03-18 17:45:04

老版本的node(比如8)在请求用let's encrypt的https证书加密的网站时会报错certificate has expired

有几种解决办法,最正确的是升级node版本,我试了下14就不报错了。。
最省事的是在env里加一句NODE_TLS_REJECT_UNAUTHORIZED=0

更灵活点可以在具体的请求里忽略tls报错

const https = require("https");

const agent = new https.Agent({
  rejectUnauthorized: false,
});

最硬核的就是改node源码自己编译了。。

#1327 | 2024-03-12 15:30:34

HTTP 418 I'm a teapot