Category: Code Snippet
Removing certain text in multiple filenames in OS X
I had a large number of ebooks that looked like the following: Walter%20Isaacson%20-%20Einstein_His%20Life%20And%20Universe.mobi And because I’m lazy, I looked for an automated way to clean all of them up. This is how: 1. Back up all your files in another directory2. Launch terminal3. Go to the directory you’d like to perform the changes4. Type: for…
Pretty-print XML or jSon via the Terminal in OS X
Simply copy the jSon or XML into your clipboard and then run one of the following: pbpaste | python -m json.tool > formatted.json For XML: pbpaste | xmllint –format – > formatted.xml
Create random 16-digit number with Groovy in soapUI
It’s easy as 1, 2, 3. Create a DataGen step with the following: Type = ScriptMode = Read Add the following script: long number = (long) Math.floor(Math.random() * 9000000000000000L) + 1000000000000000L That’s it!
Playing with .jar files
For archival purposes. Operation Command To create a JAR file jar cf <em>jar-file input-file(s)</em> To view the contents of a JAR file jar tf <em>jar-file</em> To extract the contents of a JAR file jar xf <em>jar-file</em> To extract specific files from a JAR file jar xf <em>jar-file archived-file(s)</em> To run an application packaged as a JAR file (version 1.1)…