
jimmy
加入于 2024年10月16日
想对一个 pdf 进行中英翻译,并排展示,试了下沉浸式翻译,效果还不错,就是免费用户会有水印,于是祭出 Claude Code,经过几轮沟通后,也实现了一个 Lite 版本,确实方便。
如果你也想做一个类似的工具,可以尝试以下 Prompt:
Create a Python-based PDF bilingual translation tool with the following specifications:
Create a command-line application that converts PDFs into bilingual format with original and translated text displayed side-by-side. The project should include:
Core Features:
- Extract text from PDF files with intelligent paragraph detection
- Translate using multiple AI providers (OpenAI, Google AI/Gemini)
- Generate bilingual PDFs with side-by-side layout (original left, translation right)
- Translation caching system for resumable processing
- Table of Contents extraction and preservation
- Support for CJK languages (Chinese, Japanese, Korean) with proper fonts
- Configurable settings via JSON config file
- Comprehensive command-line interface
Technical Requirements:
- Dependencies: pdfplumber, reportlab, openai, google-generativeai, PyPDF2, pathlib2, typing-extensions
- Font Management: Dual font system with separate English and CJK font support, automatic font fallback
- PDF Layout: Landscape A4 format with responsive column widths
- Caching: MD5-based translation cache using pickle files
- Concurrency: Multi-threaded translation processing (default 3 workers)
- Error Handling: Robust error handling for API failures, network issues, and invalid PDFs
File Structure:
pdf-trans/
├── pdftranslator.py # Main application with PDFTranslator class
├── config.json # Configuration file with font paths, settings
├── requirements.txt # Python dependencies
└── README.md # Comprehensive documentation
Key Command-Line Arguments:
- Required: inputpdf, --target-lang
- Optional: --output, --source-lang, --provider (openai/google), --model, --api-key, --api-url, --cache-dir, --concurrent, font settings, --verbose
Configuration Features:
- JSON config with default providers, models, languages
- Font configuration for different OS (macOS, Linux, Windows)
- PDF formatting settings (font sizes, spacing, layout)
- Translation settings (temperature, max tokens, retry attempts)
Special Capabilities:
- Automatic paragraph detection with sophisticated text segmentation
- Mixed font rendering for documents with both English and CJK characters
- HTML character escaping and substitution for problematic characters
- Bookmark preservation from original PDF to bilingual output
- Environment variable support for API keys
- Resume interrupted translations using cache
The tool should be production-ready with comprehensive error handling, logging, and user-friendly CLI experience.
https://nodaysoff.run/
作者从 2015 年 7 月 11 号开始跑步,一直跑到现在,中间没有一天中断,太厉害了···
网站的 Data Visualization 做的很棒,Strava 收集的信息也真是丰富。
In July 2015, something changed. I headed out on a run on a Tuesday, then did another one the next day, and the day after, and… I took the Friday off. When I woke up on July 11, 2015 I remember thinking I could have done 4 days in a row, so I set out to try and do that. 4 days turned into a week, then a month, then two, then six, then a year, and here I am, ten years later.典型的跑着跑着就上瘾了😂 不免让我想起了 yihong
https://www.indragie.com/blog/i-shipped-a-macos-app-built-entirely-by-claude-code
作者分享了使用 AI 工具 Claude Code 开发 macOS 应用 Context 的经历。Context 是一款用于调试 MCP 服务器的 macOS 原生应用,其代码几乎 100% 由 Claude Code 生成。作者详细介绍了从 GitHub Copilot 到 Claude Code 的转变,以及选择 Claude Code 的原因,同时分享了自己在使用 CC 时的一些心得,值得一看。
Claude is competent at using most Swift language features up to Swift 5.5, when Swift Concurrency was introduced. Swift Concurrency was a drastic change to the language, and in my opinion, hard for even humans to use correctly. Claude also gets confused when trying to pick between the modern frameworks and the legacy equivalents. It will often try to use legacy Objective-C APIs when a more modern Swift replacement is available, or use AppKit/UIKit in place of SwiftUI.强如 CC,在面对 Swift Concurrency 时也会选择逃避 😂
这个是初尝试 Vibe Coding 的一个作品(Cursor + Claude Code),中间还是踩了蛮多坑的。最后从这个开源的五子棋程序中,抽离了算法(抽离的过程也是 Claude Code 帮忙做的)实现才终于达到基本可玩的程度。
https://gomoku.limboy.me/
之前 Wordle 很火的时候,跟风做了一个猜成语游戏。有一阵还挺火的,新加坡的电台都有推荐,甚至英国的卫报都发来采访邀请。每小时更新一次,还是挺好玩的😊
https://idiom.limboy.me/
这个视频介绍了 Juice 的概念,印象中有一个动画片很好的诠释了这个概念:猫和老鼠。
A juicy game feels alive and responds to everything you do tons of cascading action and response for minimal user input.视频里作者们从一个简单的打方块游戏开始,一步步让游戏变得 Juicy,到最后一个简单的游戏,好像就有了玩的欲望。这个概念其实也不局限于游戏,用在 App 中应该也有不错的效果。 https://www.youtube.com/watch?v=Fy0aCDmgnxg
这是 Coder & Designer Paul 的摄影页面,除了照片本身质量很高外,页面的设计也很赞,每个地点的元素很丰富,有照片、视频、餐馆、笔记、地区等等,而且融合地非常好,可能是我看过的设计最棒的摄影页面了。
PS: 作者之前这个 site 用的是 zola,运行了 10 多年,后来改成了 Next.js
https://photos.paulstamatiou.com/
无意中发现的一个越南视觉设计师的网站,甚是喜欢。
I taught myself with borrowed sketchbooks and long hours of observation — sketching what I saw, recording what I felt. I collected fragments of daily life: textures, gestures, overheard stories, the quiet poetry of familiar streets.
Over time, this self-taught path shaped my practice into what it is now — vibrant, culturally-rooted storytelling through illustration, where colors and memories meet.https://luongdoo.com/
这个 Dia 浏览器的拖拽 Tab 到 Split Area 的细节很舒服,当两者越来越近时,Split Area 会「迎」上去,然后黏在一起,分开时也有中恋恋不舍的感觉。
https://x.com/adamstern_/status/1943320188901785610
分享个小作品:笔画猜成语。规则蛮简单的,就是根据给出的部分笔画,猜目标成语。笔画数会随时间的流逝慢慢变多(每1分钟多 10%,最多显示 50%)。每天一个成语。媳妇儿还挺爱玩的。
https://stroke.limboy.me/
作者分享了他构建大型软件项目的一些技巧,基本赞同。(PS:Ghostty 确实挺不错的,已经是我的默认终端了)
在项目启动阶段,最困难的是找到一个合适的切入点。他建议选择一个能够尽快看到结果的“子项目”,即使这些结果最初可能不那么“可见”,也可以通过自动化测试来验证进展。例如,在开发终端模拟器时,他选择从 VT 解析开始,通过编写测试用例来验证解析器的功能,从而获得“测试通过”的成就感。
核心是以下几个步骤:
将大问题分解为小问题,每个小问题都必须有清晰的可见结果。
只解决小问题到足以推动大问题的演示层面,然后转向下一个小问题。
解决足够多的小问题,以便开始构建可运行的软件演示,然后继续迭代更多功能,尽可能频繁地进行演示。
如果适用(个人项目或解决自身问题的项目),优先开发能让自己采纳软件的功能,并持续首先解决自己的问题。
根据需要,返回并迭代改进每个组件,重复此过程。
https://mitchellh.com/writing/building-large-technical-projects
Yet Another Web Page Summarizer. 之所以想分享这个工具,一方面是工具本身挺好用的,还有就是官网页面的设计,挺简洁大气,可以作为模版用在自己的一些 project 上。
https://www.elmo.chat/
非常喜欢的 WWDC25 的一个视频。作者从 idea 开始,结合设计上的最佳实践,一步步对 App 进行改造。中间可以多暂停几次,想象如果是自己来设计这个 App 会如何考虑,然后跟作者的解决方案对比,看哪个更好。非常推荐给想把 Design 技能包装入囊中的 Coder。
https://www.youtube.com/watch?v=dGcqqA3Sl-o
作者花了 5 年的时间做了这个动画库,确实酷!可以在这里一窥这个网站是如何做出来的。 https://x.com/JulianGarnier/status/1910336387812860380
有人问到,这个网站从想法到实现大概花了多久,作者的回复:
I started working on the website in early January, spent around 3 weeks on the design, then one month on the dev, and an other month on the copy, performance improvements and refined the design before release.https://animejs.com/