Skip to content

Instantly share code, notes, and snippets.

View foru17's full-sized avatar
🎯
Focusing

Luo Lei foru17

🎯
Focusing
View GitHub Profile
@foru17
foru17 / cloudflare-workers-proxy-images.ts
Created August 25, 2023 10:49
A Cloudflare Workers script automatically uploads existing images to the Cloudflare Images service.
// Cloudflare Images 鉴权API文档
// https://developers.cloudflare.com/images/cloudflare-images/api-request/
const CF_IMAGES_ACCOUNT_ID: string = "<账号ID>";
const CF_IMAGES_API_KEY: string = "<CLOUDFLARE IMAGES API KEY>";
const CF_IMAGES_BUCKET_NAME: string = "<账号HASH>";
// 白名单域名
@foru17
foru17 / remove_duplicates.py
Last active January 23, 2024 19:33
remove duplicates file witch hash check
import os
import re
import hashlib
# 设定工作目录
DIR = "/Volumes/Desktop"
def calculate_hash(filepath):
hasher = hashlib.sha256()
with open(filepath, 'rb') as f:
@foru17
foru17 / git-commit-user-reset.sh
Created March 20, 2024 10:38
reset git user name and email
git filter-branch --env-filter '
OLD_NAME="old_name"
OLD_EMAIL="[email protected]"
CORRECT_NAME="luolei"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_NAME" = "$OLD_NAME" ] && [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
rule-providers:
reject:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt"
path: ./ruleset/reject.yaml
interval: 86400
icloud:
type: http
@foru17
foru17 / cloudflare-worker-bulk-zip-and-download.ts
Last active September 2, 2024 08:04
zip files and download by cloudlfare worker
// 通过 Cloudflare Worker 批量打包和下载现存文件
// curl -X POST https://your-worker-endpoint/create-zip \
// -H "Authorization: Bearer YOUR_AUTH_SECRET" \
// -H "Content-Type: application/json" \
// -d '{
// "filePaths": [
// "path/to/file1.jpg",
// "path/to/file2.png",
// "path/to/file3.pdf"
// ]