Access OS X keychain from Terminal
At everyday scripting, you often need to access sensible information like passwords. A common practice is to just write them plain text into your script, but at least on a Mac, we can do better. OS X ships with a tool called keychain. It is a central database where tools can store sensitive information like [...]
How to patch binary files with Java
Recently, I wanted to create an “intelligent” binary patcher, which not only replaces some chunk of binary data at a file’s predefined offset, but instead performs search and replace. Here is the Java class I came up with. import java.io.*; import java.math.BigInteger; public class BinaryPatcher { private String content; private final String filename; private final [...]
Robust HTML parsing the Groovy way
With Groovy, it’s very easy to parse XML data and extract arbitrary information. This works great as long as the input data is well-formed, but you can’t always guarantee that in real-world scenarios. Think of extracting data from HTML pages. They are very often a mess when it comes to XML validity and that’s where [...]
