Awesome one-liner snippet thread

Did you run into a useful short snippet? Share it here.

Silence warnings coming from Java code

(System/setErr (java.io.PrintStream. (java.io.ByteArrayOutputStream.)))

I was using Sparkledriver for some stuff, but the underlying jBrowserDriver has the nasty habit of spitting out some big ugly stacktraces whenever it starts, so I did this to get around that. The cool thing is that this is separate from Clojure’s *err* or *out*, so you still see output from Clojure code. Of course doing this will mean you might miss error messages, so maybe it’s better to store the value of System/err, and restore it afterwards.