Skip to content

Instantly share code, notes, and snippets.

View mp911de's full-sized avatar
🚑
I may be slow to respond…

Mark Paluch mp911de

🚑
I may be slow to respond…
View GitHub Profile
@mp911de
mp911de / ChoiceValuesService.java
Last active December 20, 2015 06:29
Suite for WebService Delegators
public interface ChoiceValuesService {
ChoiceValues getChoiceValues(String choiceValuesId, boolean useCache) throws ChoiceValuesNotFoundException;
}
@mp911de
mp911de / WienerProcess.java
Last active December 22, 2015 15:28
WienerProcess using Apache commons-math
import org.apache.commons.math3.distribution.NormalDistribution;
import java.time.LocalDate;
import java.util.*;
import static java.lang.Math.sqrt;
import static java.lang.Math.exp;
public class WienerProcess {
/**
* Run the Wiener process for a given period and initial amount with a monthly value that is added every month. The
@mp911de
mp911de / FieldComparisonQLToken.java
Created November 12, 2013 07:26
Leveraging dynamic queries
/**
* @author <a href="mailto:mpaluch@paluch.biz">Mark Paluch</a>
* @since 07.11.13 12:36
*/
public class FieldComparisonQLToken implements FieldQLToken {
private String field;
private String value;
private QueryComparator queryComparator = QueryComparator.EQUAL_TO;
@mp911de
mp911de / Jar-Files for OGM000059: Unable to find a GridType for string, Hibernate OGM, Redis.txt
Created December 28, 2015 21:23
Jar-Files for OGM000059: Unable to find a GridType for string, Hibernate OGM, Redis
antlr:antlr:2.7.7
biz.paluch.redis:lettuce:3.2.Final
com.fasterxml.jackson.core:jackson-annotations:2.4.1
com.fasterxml.jackson.core:jackson-core:2.4.1
com.fasterxml.jackson.core:jackson-databind:2.4.1
com.fasterxml:classmate:1.0.0
com.google.guava:guava:17.0
dom4j:dom4j:1.6.1
io.netty:netty-buffer:4.0.28.Final
io.netty:netty-codec:4.0.28.Final
@mp911de
mp911de / Main.java
Created December 22, 2015 15:05
Wiener Process with Java and JFreeChart
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.title.TextTitle;
import org.jfree.data.time.Month;
import org.jfree.data.time.TimeTableXYDataset;
import org.jfree.data.xy.TableXYDataset;
import org.jfree.ui.RectangleEdge;
import org.jfree.ui.VerticalAlignment;
@mp911de
mp911de / devices.xml
Created December 13, 2013 18:47
Example output of player/devices
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<midiDeviceInfos>
<device id="0">
<name>Gervill, Software MIDI Synthesizer (OpenJDK)</name>
<types>
<type>SYNTHESIZER</type>
</types>
</device>
<device id="1">
<name>Real Time Sequencer, Software sequencer (Oracle Corporation)</name>
@mp911de
mp911de / RedisConfiguration.java
Created February 5, 2016 13:26
Gist to reproduce behavior in DATAREDIS-411
/*
* Copyright 2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
import static org.springframework.data.mongodb.core.query.Criteria.where;
import java.net.UnknownHostException;
import java.util.List;
import javax.annotation.PreDestroy;
import lombok.Data;
import org.junit.Test;
@mp911de
mp911de / JMH Results.txt
Last active March 28, 2016 09:15
Long Parsing Benchmark
# JMH 1.11.3 (released 74 days ago)
# VM version: JDK 1.8.0_71, VM 25.71-b15
# VM invoker: /Library/Java/JavaVirtualMachines/jdk1.8.0_71.jdk/Contents/Home/jre/bin/java
# VM options: -Dvisualvm.id=43580837207773 -Didea.launcher.port=7533 -Didea.launcher.bin.path=/Applications/IntelliJ IDEA.app/Contents/bin -Dfile.encoding=UTF-8
# Warmup: 5 iterations, 1 s each
# Measurement: 5 iterations, 1 s each
# Timeout: 2 s per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: com.lambdaworks.redis.protocol.LongParsingBenchmark.longProcessor
@mp911de
mp911de / Redis RESP.md
Created March 28, 2016 14:59
Redis RESP summary

All elements are CRLF terminated. CRLF in the examples mean additional CRLFs.

Syntax Type null? empty? data/value
+ Simple string no + ASCII string, non-binary safe
- Simple error string no - ASCII string, non-binary safe
: Integer no no ASCII-represented 64bit integer
$(integer)CRLF(data) Bulk $0CRLF $-1 Binary safe chunk of bytes
*(integer) Array *0 *-1 Array header holding a length/null indicator