惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
B
Blog RSS Feed
博客园_首页
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Google DeepMind News
Google DeepMind News
D
Docker
Blog — PlanetScale
Blog — PlanetScale
M
MIT News - Artificial intelligence
C
Check Point Blog
The Cloudflare Blog
T
Tailwind CSS Blog
大猫的无限游戏
大猫的无限游戏
量子位
The GitHub Blog
The GitHub Blog
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
T
The Blog of Author Tim Ferriss
博客园 - 【当耐特】
Vercel News
Vercel News
P
Proofpoint News Feed
Hugging Face - Blog
Hugging Face - Blog
V
V2EX
博客园 - 司徒正美

Steve Hanov's Blog

How this Canadian Startup Bought Millions of Impressions for $8,000 How to Run a Fellowship Program Into the Ground (and get 18M impressions in the process) My Waterloo Intern went back to school. I'll miss him dearly but here's how I replaced him with Hermes I learned Mandarin. Here's what it taught me about B2C SaaS. The VC's Waterloo Coffee Tour: Where to Find Canada's Next Unicorn How I run multiple $10K MRR companies on a $20/month tech stack How to Save a Gemini Canvas as Markdown A Ralph Loop for Reading: Beating GPT 5.2 with a 4k Context Window (and 4 GPUs) I built a Chrome extension that lets an LLM “see” tweets Make a web page screenshot service Automatically remove wordiness from your writing I found Security Vulnerability in your web application How to detect if an object has been garbage collected in Javascript My favourite Google Cardboard Apps O(n) Delta Compression With a Suffix Array Finding Bieber: On removing duplicates from a set of documents Let's read a Truetype font file from scratch A Quick Measure of Sortedness My thoughts on various programming languages A little VIM hacking
Fighting Blog Comment Spam with Qwen3 and Ollama
2025-05-13 · via Steve Hanov's Blog

I'll admit it. I've been neglecting my blog. I went back recently and found a wall of comment spam.

I've tried various ways of fighting it over the years. For a while, having written my own blog in php meant the problem wouldn't exist. The bots would relentlessly try submitting comments via wordpress URLs, which my system didn't understand.

When that stopped working, I introduced a hidden email field that only scripts could see. If it was filled out, I could ignore the comment right away. Somehow, that stopped working.

I built a user interface where I could click a delete button on each comment and they would implode on my screen. It was satisfying, but it still required me to log in once in a while and do it. So the comments built up, and I kind of gave up.

Luckily, I happen to have an AI rig in my bedroom, with ollama and several models installed. I decided to set it to work. I won't go into the details here. There is no need! Here is the prompt I mashed into Visual Studio Copilot, with Claude Sonnet 3.7 agent mode selected. Note that I had lost the database schema of my blog, so I didn't even know how the comments were stored.

  1. Carefully examine the BlogDb class and deduce the schema of the Comments table.
  2. Get the details of the database from the index.php file, including the connection details.
  3. Write a python script. On startup, it will connect to the database. If not present, it will add the "classification" string-type column to the comments type, with default value "".
  4. Devise a prompt that will take blog article contents, and a comment, and decide if the comment is spam or not.
  5. The python script will then iterate through all comments that have the empty-string classification field. It will forward each one and the spam classification prompt to an ollama server at https://example.com. Use the model "qwen3:32b".
  6. The python script will, based on the returned classification, update the classification field of the comment in the database to "spam" or "not-spam"

Ten minutes later, it was done. It then spent the next few hours classifying all the comments (about eight seconds each) and writing detailed analysis on its reasoning. They were fascinating to read.