Skip to content

Instantly share code, notes, and snippets.

View tshu-w's full-sized avatar
🤯
Exploring

Tianshu Wang tshu-w

🤯
Exploring
View GitHub Profile
@tshu-w
tshu-w / backup-overleaf.sh
Created December 30, 2022 13:43
Backup Community Edition Overleaf Project
#!/usr/bin/env sh
HOST="overleaf.cipsup.cn"
PROJECT_ID="627220cc14ecd4008b9ae727"
DIRECTORY="$HOME/Library/CloudStorage/OneDrive-Personal/Backups/Overleaf/$PROJECT_ID"
OUTPUT="main_`date +"%Y-%m-%dT%H%M"`.zip"
COOKIE="$OVERLEAF_COOKIE"
curl "http://$HOST/project/$PROJECT_ID/download/zip" \
-H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15" \
@tshu-w
tshu-w / .MitM4OpenAI.md
Last active June 6, 2024 11:01
OpenAI API 全局请求重定向

使用 MitM 加代理工具实现 OpenAI API 请求全局重定向

Surge (macOS Only)

  1. 在 Surge 中安装 CA 证书并使用 AIProxy.sgmodule 模块。

Clash + MitMProxy

  1. 安装 MitmProxy 以及 CA 证书
  2. 后台运行 MitMProxy 并设定重定向规则,例如:screen mitmproxy --map-remote '|//api.openai.com/|//api.aiproxy.io/' -k
  3. 在 Clash 中添加配置,将 api.openai.com 的请求走 HTTP 8080 端口代理,并开启增强模式
@tshu-w
tshu-w / image_crawler.py
Created June 16, 2023 08:27
Image Crawler for WDC product images.
#!/usr/bin/env python
import itertools
import json
import logging
import os
import re
import shutil
import sys
import zlib