Script to Detect Slow USB-C Cables
Kaushik Gopal (via Hacker News):
You have a drawer full of USB cables. Half are junk that barely charge your phone. The other half transfer data at full speed. But which is which?
[…]
The script parses macOS’s
system_profiler SPUSBHostDataTypecommand, which produces a dense, hard-to-scan raw output[…][…]
The first version was a bash script I cobbled together with AI. It worked, but was a mess to maintain. Because I let AI take the wheel, even minor tweaks like changing output colors were difficult.
But then he asked Claude to rewrite it to be easier to maintain.
That’s the real story. Not the script, but how AI changes the calculus of what’s worth our time.
Previously:
- Vibe Coding
- USB-C Cables Comparison
- Avoid Overspending for iPhone 15 USB-C Cables and Chargers
- USB Simplifies Branding But Reintroduces Active Cables
- USBefuddled
- How Many Kinds of USB-C to USB-C Cables Are There?
Update (2025-10-14): Ben Fry:
Quick hack to detect the speed of plugged-in USB devices on macOS, then write a simple HTML page with the info and open it in a browser. Very basic Python script now posted as a GitHub gist.
4 Comments RSS · Twitter · Mastodon
If you look at the generated code it’s...something, but maintainable isn’t one of them.
I think vibe coding is still something half-baked. I see the value in having these models help with boilerplate, but they require a lot of handholding and if there is serious production code out there being constructed like this, infosec teams are going to have a field day (or a migraine) for a while.
100% agree! I started automating things in my gaming pc using powershell which I never even considered because I don’t know powershell. But it’s intuitive enough to read, and giving precise enough instructions to an LLM results in working code.
You can get good results if you have a design in mind and guide the AI, step-by-step. You are involved more in the coding, but you still save time. It’s like a macro to do a task that you have in mind. The unmaintainable stuff happens when you just fire off "write me an app to do _x_" and walk away.
I’ve had good results with GitHub Copilot. It does save work. It does change the math behind the ROI and makes things worth it that would not be otherwise.
I wrote a tool at work that required PowerShell and Bash and Python. I don’t particularly like Bash nor know PowerShell. Gas I not used Copilot, it wouldn’t have been worth my time to create this tool. But Copilot made it possible and efficient. Very cool.
In the hands of a software engineer, it’s amazing. But it does require a software engineer knowing exactly how to prompt, then how to refine when the LLM spits out garbage. You need to guide it.