jps - ps just for Java

July 11, 2018

I came across a command today that I didn't know existed. It's part of the JVM and it lists just the java processes running on a given machine:

$ jps
2946 org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
3144 GradleDaemon 
3083 GradleDaemon
24092 Jps

If can also list ...

Tags: jps ps java

Corosync & Pacemaker

July 10, 2018

Corrosync and Pacemaker offer a toolset to ensure high availability of services on Linux, and other platforms. You setup a cluster of machines and start services on them. Services can be moved between machines, and will failover to other machines in the cluster if they fail. Here are my notes ...

Filtering Sets in Java 8

June 14, 2018

Given a set, it's possible to filter it using a particular condition in Java 8.

Here's the set we're playing with:

Set<String> set = new HashSet<>();
set.add("ABC123"); 
set.add("ABC124");
set.add("ZZZ111");
set.add("ABC125");

I'm now looking to create a new set ...

Grep in Python 2

May 28, 2018

Here's some quick example code I used to perform a grep in Python 2.

:::python import os, fnmatch, ConfigParser, time

def locate(pattern, root=os.curdir):
    """ 
    Locate all files matching supplied filename pattern in and
    below the supplied root directory
"""
for path, dirs, files in os.walk(os.path ...

Tags: grep python

Grepping Docker Logs

May 4, 2018

Some of the things in docker logs are written to stdout and others to stderr. If you grep like this:

$ docker logs my-docker-container | grep "Thing that doesn't exist in the file"

The output will show any lines from the docker log that were written to stderr. This may be ...