Start and stop Jenkins on a Mac

Jenkins will start itself immediately after installing it via a dmg package on a Mac. These are the commands to start / stop it as necessary.

To start the service:

sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

To stop the service:

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

Posted in Linux | Comments Off on Start and stop Jenkins on a Mac

View file permissions in octal format on Mac OS

Execute this command:

stat -f %Mp%Lp

Posted in Linux | Comments Off on View file permissions in octal format on Mac OS

Convert putty ssh private key to openSSH (linux format)

To convert a putty key to a linux key, do this:

puttygen privatekey.ppk -O private-openssh -o privatekey.pem

Posted in Linux | Comments Off on Convert putty ssh private key to openSSH (linux format)

Free space in current directory in linux

To find out how much free space you have in the current directory in linux, type

df $PWD | awk '/[0-9]%/{print $(NF-2)}'

Posted in Linux, Uncategorized | Comments Off on Free space in current directory in linux

Mac OS Time machine encryption

Today I got a new hard drive, and I wanted to do a backup of my laptop with it using Time Machine. Before the backup, I was prompted if I wanted to encrypt the backup as well. Well, I thought, why not?
Big mistake! The backup started, finished… and then Time Machine started to encrypt the backup drive. The ENTIRE drive. I was stuck at 1% for about 20 minutes when I got worried.
I couldn’t eject the backup drive, I couldn’t stop the encryption. I thought I was screwed.
I started looking on the internet for a way to stop or revert the process. One post claimed that it can take days to fully encrypt a drive. DAYS! I had been planning to take the laptop to a cafe just about right then. Guess that was not an option any more.
So long story short, lots of people claimed that an encryption in progress can’t be canceled. Others said it could. Some people said to use Disk Util to decrypt. But I found no option do do this while the backup was still running.

I finally got the following command for the terminal from some site, and tried it:

diskutil cs revert /Volumes/my_drive_name -passphrase

where you can get the actual value for your disk (the ‘my_drive_name) using this command:

ls -al /Volumes

I entered this command while Time Machine was still encrypting. The terminal asked me for my encryption password. After that, it only took a moment, and the disk started to quiet down a bit. I checked the status of Time Machine, and it said nothing more about any encryption going on. The Terminal said that the decryption was going on. And this is important: Decryption is not instantaneous. Basically, the terminal was now reverting all the encryping that Time Machine had started.
After a couple of minutes more, the disk slowed down and then stopped spinning completely. I ejected it, and it worked. I reconnected it then, and checked the Time Machine settings. The checkmark for ‘encryption’ was off! All looked well. So as a last test, I looked at the disk in Finder, and all the backup data was still there! So I guess this solved it, saving me maybe days of worry!

Posted in Technology | Comments Off on Mac OS Time machine encryption

Remote debugging jetty

To remote-debug jetty running on the command line, put this before you execute mvn jetty:run

export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

Then debug on port 8000 in your IDE.

Posted in Linux | Comments Off on Remote debugging jetty

Reset password for git

If your git password changed, and you need to push / pull something, you will get an authentication error. To reset the password on OSX (Mac), enter this:

git credential-osxkeychain erase

After that, if you try to push / pull once again, you will be prompted to re-enter your (new) password.

Posted in Technology | Comments Off on Reset password for git

Installing Java on OpenSuse Linux via RPM

To install linux via console on an OpenSuse machine, do the following:

1. Download the fitting RPM from Oracle:

On the console, enter uname -m. If you get x86_64, you need the 64 bit version of the RPM file. Otherwise take the 32 bit version.
Go to Find the download page and copy the link for the correct version. The problem you will now face is that you cannot directly download the file using for example ‘wget’, because you need to send a cookie to the server which says that you accepted the software license for the download. But you can send the cookie via console as well, like this:

wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie"

This should start the download

2. You should now be able to install the RPM

First, become the super user by typing:


Then type:

rpm -ivh jdk-8u45-linux-x64.rpm

(Of course the name of your file might be different).

If you get this error:

‘/usr/sbin/alternatives is needed by jre…’,

then you have to create a symlink first. So do this:

ln -s /usr/sbin/update-alternatives /usr/sbin/alternatives

Then type this, and it should work:

rpm -ivh --nodeps jdk-8u45-linux-x64.rpm

(Note the –nodeps argument here)

Now you should remove the ‘old’ java that is pre-installed with Suse:

zypper rm icedtea-web

3. Point the system to the new java version

Finally, point to the new installation:

update-alternatives --install "/usr/bin/java" "java" "/usr/java/latest/bin/java" 1

update-alternatives --set java /usr/java/latest/bin/java

4. Finally, to also make the new java work with your web browser, do this (if you have a 64 bit system):

ln -s /usr/java/latest/lib/amd64/ /usr/lib64/browser-plugins/

If you have a 32 bit system, do this instead:

ln -s /usr/java/latest/lib/i386/ /usr/lib/browser-plugins/

5. Test if Java is available

by typing

java -version

This should now show the version you downloaded earlier.

6. If you cannot execute Java programs now, try to set the JAVA_HOME variable:

export JAVA_HOME=/usr/java/latest

Posted in Linux | Comments Off on Installing Java on OpenSuse Linux via RPM

Finding text inside a zip file

If you need to find text that is somewhere inside a zip file, you can’t use the linux ‘grep’ tool. But you can use another tool: zipgrep.
The syntax is as follows (to find ‘myText’ inside all .jar files).

find . -name "*.jar" -exec zipgrep "myText" '{}' \;

Posted in Linux | Comments Off on Finding text inside a zip file

Json marshaling and field names

If you are using Jackson to marshal and unmarshal Java objects and Json, you might get different behavior depending on how the marshaling is called. For example, I was first using marshaling using a Java-RS webservice, which works something like this:

    public MyObject getMyObject() {
     return new MyObject();

This returns the object as Json. And if the object has getters like ‘getXValues()’, then the Json will look like this:

{"XValues": ...}

Then I switched to Spring MVC, and now my method looks like this:

    @RequestMapping(value = "/myObject",method= RequestMethod.GET, produces=MediaType.APPLICATION_JSON)
    public Quote getQuoteGold() {

And the Json looks like this:

{"xvalues": ...}

So the upper case is not represented. Then if you want to access the fields explicitly later, you will run into problems. Especially if you can’t change the receiving end any more.

The way to get out of this is to explicitly tell the marshaling library how to name the fields in Json. This will work like this:

public class MyObject { 

    public List<Long> getXvalues() {
        return xValues;

Now the Json will name the field according to what you tell it to.
It is worth noting that I found two annotations with the same name, (but from different packages) for these two properties (JSonSerialize, JsonProperty), and only one works. For me these were

Posted in Uncategorized | Comments Off on Json marshaling and field names