Skip to content

Instantly share code, notes, and snippets.

View cowtowncoder's full-sized avatar

Tatu Saloranta cowtowncoder

View GitHub Profile
Started by upstream project "pipeline/publish-the-world" build number 148
originally caused by:
Started by user [ME]
Obtained jenkinsfiles/FFF from git git@XXX
Running in Durability level: PERFORMANCE_OPTIMIZED
Loading library pipeline@release/2.x
Attempting to resolve release/2.x from remote references...
> git --version # timeout=10
using GIT_SSH to set credentials SSH key for Gitlab
> git ls-remote -h git@XXX # timeout=10
@cowtowncoder
cowtowncoder / IapDatabind.java
Created February 5, 2016 05:24
Example of how IAP/ION codec for jvm-serializers could look like
package serializers;
import java.util.Arrays;
import com.jenkov.iap.ion.read.IonObjectReader;
import com.jenkov.iap.ion.write.IonObjectWriter;
import data.media.MediaContent;
/**
@cowtowncoder
cowtowncoder / lentil-chili.md
Created October 9, 2013 00:16
Lentil Chili Recipe. Code for Food

Lentil Chili (non-vegetarian)

Ingredients

  • 2 lbs Italian sausage
  • 2 medium onions, chopped
  • 1 cup celery, chopped
  • 2 cups lentils
  • 28 oz (2 x 14) of stewed tomatoes
  • 30 oz (2 x 15) of tomato sauce
@cowtowncoder
cowtowncoder / gist:4121515
Created November 20, 2012 21:58
Immutable POJO that Just Works with Jackson
/**
* This class works just fine, although you might not think so at first glance.
* Serialization is easy -- just uses getters, after all -- but how about deser?
* Turns out that:
*
* (a) Since Jackson auto-detects private fields (as long as something else indicates
* presence of a property; here getters do it), and
* (b) JDK (1.5+) allows Reflection to force setting of a 'final' value
*
* it... well, works. Try it for fun!
@cowtowncoder
cowtowncoder / IncrementalMurmur3Hasher
Created August 29, 2012 00:38
Incremental Murmur3/32bit, my first take (has unit tests, seems to work; caveat emptor)
public final class IncrementalMurmur3Hasher
{
protected final static int c1 = 0xcc9e2d51;
protected final static int c2 = 0x1b873593;
protected final static int c3 = 0xe6546b64;
private final int _seed;
/**
@cowtowncoder
cowtowncoder / gist:1453666
Created December 9, 2011 22:48
Reading CSV data as Maps
private int readAll(File inputFile) throws IOException
{
int count = 0;
CsvMapper mapper = new CsvMapper();
// need a Schema just to force use of header line (to get column names)
CsvSchema schema = CsvSchema.builder()
.setUseHeader(true)
.build();
// read CSV as sequence of Objects, binding as regular Map (not POJO)
@cowtowncoder
cowtowncoder / jvm-serializers-stream-2011-10-03.txt
Created October 3, 2011 18:34
Preliminary results for jvm-serializers, data-stream
MacBook-Pro% ./run-stream data-stream/media.9.cks
Checking correctness...
[done]
create ser +same deser +shal +deep total size +dfl
java-manual 1405 15819 14622 12907 13581 14259 30077 2337 620
hessian 1411 41665 33286 56918 57621 58584 100249 2481 800
protobuf 2978 39151 20280 23551 24770 26197 65348 2198 654
thrift 2951 42119 38970 24240 25234 26443 68562 3235 717
thrift-compact 2952 40505 37073 24486 25628 26874 67379 2210 639
avro 1995 41140 38919 25841 34465 41194 82334 1999 576
package test;
import java.util.*;
import javax.ws.rs.core.*;
public final class RestJsonApplication
extends Application
{
public Set<Class<?>> getClasses()
package test;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
package test;
import java.util.*;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
/**
* Test root resource to show case use of JSON
*/