Skip to content

Instantly share code, notes, and snippets.

Jens Rantil JensRantil

Block or report user

Report or block JensRantil

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
JensRantil /
Created Feb 8, 2014
As close as one can get to a Java typedef. That is, wrapping a type. Lots of boilerplate code for something that could be so short and concise.
* A first name.
* <p>
* In other programming languages, you would be able to write something like
* <code>
* typedef FirstName String;
* </code>
public class FirstName {
private String firstName;
View myapp.conf
description "my application"
start on runlevel [2345]
stop on runlevel [!2345]
respawn limit 360 180
setuid myuser
setgid mygroup
chdir /my/directory
exec /bin/sleep 60
View real_myapp.conf
description "my application"
start on runlevel [2345]
stop on runlevel [!2345]
respawn limit 360 180
setuid myuser
setgid mygroup
chdir /my/directory
exec java -jar /srv/my.jar
JensRantil /
Last active Aug 29, 2015
Nullcheck abstraction ideas.
public class NullcheckAbstractionsExamples {
public void Example1( ) {
NullablePair pair;
pair = Nullables.pair(myObject1.getProperty(), myObject2.getProperty());
if (pair.anyNull())
pair = Nullables.pair(myObject1.getProperty().getSubProperty(), myObject2.getProperty().getSubProperty());
if (pair.anyNull())
JensRantil / gist:0d905461cf018c5e1ab7
Created Jul 30, 2014
Broken SSL verification Datastax
View gist:0d905461cf018c5e1ab7
root@precise64:/etc/apt/sources.list.d# curl -L | sudo apt-key add -
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here:
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
View gist:ec43622c26acb56e5bc9
cqlsh:tink> CREATE TABLE a(a uuid, b timeuuid, c uuid, PRIMARY KEY (a,b));
cqlsh:tink> INSERT INTO a(a,b,c) VALUES (48ecda32-b32a-43ae-bd30-ecf4819fb83c, 468ee710-1bd2-11e4-b2a2-0179c71c52ea, 73e54e00-ad66-4f88-8dd8-92bc1c648e9d);
cqlsh:tink> INSERT INTO a(a,b,c) VALUES (48ecda32-b32a-43ae-bd30-ecf4819fb83c, 468ee711-1bd2-11e4-b2a2-0179c71c52ea, 2fdb7e7a-cf9d-43a4-aa86-7820336fc363);
cqlsh:tink> INSERT INTO a(a,b,c) VALUES (48ecda32-b32a-43ae-bd30-ecf4819fb83c, 468ee712-1bd2-11e4-b2a2-0179c71c52ea, 18551ae7-b117-4b41-b5fa-fd233e2425dd);
cqlsh:tink> SELECT * FROM a;
a | b | c
48ecda32-b32a-43ae-bd30-ecf4819fb83c | 468ee710-1bd2-11e4-b2a2-0179c71c52ea | 73e54e00-ad66-4f88-8dd8-92bc1c648e9d
48ecda32-b32a-43ae-bd30-ecf4819fb83c | 468ee711-1bd2-11e4-b2a2-0179c71c52ea | 2fdb7e7a-cf9d-43a4-aa86-7820336fc363
JensRantil / gist:f040e900edc8a2ee6192
Created Aug 19, 2014
spring-data-cassandra init example
View gist:f040e900edc8a2ee6192
package com.project.common.config;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import org.springframework.cassandra.core.keyspace.CreateKeyspaceSpecification;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
JensRantil / intrusion-presentation.txt
Last active Aug 29, 2015
Intrusion presentation (present with `tpp`)
View intrusion-presentation.txt
--author Jens Rantil, Tink AB
--title Intrusion
--date 2014-10-06
--center If a bad day strikes you.
--newpage goal
--heading Agenda
JensRantil / gist:555272209a1505a592dc
Created Nov 3, 2014
Jetty Bug Monitor Bug #recurse
View gist:555272209a1505a592dc
ERROR [Monitor for Jetty bugs] 2014-11-03 11:45:16,269 (line 108) Jetty bug monitor failed
at org.apache.hadoop.mapred.JettyBugMonitor.isJettySelectorThread(
at org.apache.hadoop.mapred.JettyBugMonitor.getJettyThreadIds(
at org.apache.hadoop.mapred.JettyBugMonitor.waitForJettyThreads(
at org.apache.hadoop.mapred.JettyBugMonitor.doRun(
JensRantil /
Created Dec 27, 2014
Script that generated histograms over number widths. See for an article about this.
import pylab as p
import subprocess
import argparse
from collections import Counter
import numpy as np
import itertools
# See
icolors = itertools.cycle('bgrcmykw')
You can’t perform that action at this time.