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
JensRantil / FirstName.java
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.
View FirstName.java
/**
* 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
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
respawn limit 360 180
setuid myuser
setgid mygroup
script
chdir /my/directory
exec java -jar /srv/my.jar
@JensRantil
JensRantil / NullcheckAbstractionsExamples.java
Last active Aug 29, 2015
Nullcheck abstraction ideas.
View NullcheckAbstractionsExamples.java
public class NullcheckAbstractionsExamples {
public void Example1( ) {
NullablePair pair;
pair = Nullables.pair(myObject1.getProperty(), myObject2.getProperty());
if (pair.anyNull())
return pair.compare();
pair = Nullables.pair(myObject1.getProperty().getSubProperty(), myObject2.getProperty().getSubProperty());
if (pair.anyNull())
@JensRantil
JensRantil / gist:0d905461cf018c5e1ab7
Created Jul 30, 2014
Broken SSL verification Datastax
View gist:0d905461cf018c5e1ab7
root@precise64:/etc/apt/sources.list.d# curl -L https://debian.datastax.com/debian/repo_key | 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: http://curl.haxx.se/docs/sslcerts.html
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
JensRantil / gist:f040e900edc8a2ee6192
Created Aug 19, 2014
spring-data-cassandra init example
View gist:f040e900edc8a2ee6192
package com.project.common.config;
t
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;
import org.springframework.data.cassandra.config.CassandraClusterFactoryBean;
import org.springframework.data.cassandra.config.CassandraSessionFactoryBean;
@JensRantil
JensRantil / intrusion-presentation.txt
Last active Aug 29, 2015
Intrusion presentation (present with `tpp`)
View intrusion-presentation.txt
--withborder
--author Jens Rantil, Tink AB
--title Intrusion
--date 2014-10-06
--center If a bad day strikes you.
--newpage goal
--heading Agenda
@JensRantil
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 JettyBugMonitor.java (line 108) Jetty bug monitor failed
java.lang.NullPointerException
at org.apache.hadoop.mapred.JettyBugMonitor.isJettySelectorThread(JettyBugMonitor.java:218)
at org.apache.hadoop.mapred.JettyBugMonitor.getJettyThreadIds(JettyBugMonitor.java:205)
at org.apache.hadoop.mapred.JettyBugMonitor.waitForJettyThreads(JettyBugMonitor.java:182)
at org.apache.hadoop.mapred.JettyBugMonitor.doRun(JettyBugMonitor.java:114)
at org.apache.hadoop.mapred.JettyBugMonitor.run(JettyBugMonitor.java:102)
@JensRantil
JensRantil / number_width_histogram.py
Created Dec 27, 2014
Script that generated histograms over number widths. See http://jensrantil.github.io for an article about this.
View number_width_histogram.py
import pylab as p
import subprocess
import argparse
from collections import Counter
import numpy as np
import itertools
# See http://jensrantil.github.io/line-styles-in-matplotlib.html.
icolors = itertools.cycle('bgrcmykw')
You can’t perform that action at this time.