Skip to content

Instantly share code, notes, and snippets.

My faves:

  • General - Appearance - Theme - Dark
  • Java - Editor - Typing - Auto insert - Semicolons
  • Java - Editor - Content Assist - Insertion - Completion overwrites
  • Java - Editor - Content Assist - Insertion - Insert best guessed arguments
  • Java - Editor - Content Assist - Favourites:
    • org.junit.Assert
    • org.mockito.Mockito
  • io.reactivex.Flowable
public static void main(String[] args) {
Random r = new Random();
long N = 100000L;
long n = 0;
for (long i = 0; i < N; i++) {
double max = Double.MIN_VALUE;
int recentMaxCount = 0;
for (int j = 0; j < 100; j++) {
double d = r.nextGaussian();
if (d > max) {
Using rxjava 1.1.4
java.lang.VerifyError: StackMapTable error: bad offset
Exception Details:
Location:
com/github/davidmoten/rx/jdbc/Util.newInstance(Ljava/lang/reflect/Constructor;Ljava/util/List;)Ljava/lang/Object; @0: aload_0
Reason:
Invalid stackmap specification.
Current Frame:
bci: @21
@davidmoten
davidmoten / skip-timed.txt
Last active July 26, 2016 20:47
failing test skip-timed
@Test
public void testSkipTimedDoesNotStallWhenNonMaxValueRequested() {
TestSubscriber<Long> ts = TestSubscriber.create(1);
TestScheduler scheduler = new TestScheduler();
Observable
.interval(500, TimeUnit.SECONDS, scheduler)
.doOnNext(new Action1<Long>() {
@Override
public void call(Long x) {
System.out.println(x);
#!/usr/bin/env python3
import time
name = input("What's your name? ").strip()
print('Hi', name + '! Pleased to meet you!')
time.sleep(1.5)
activities = input("Hey, what are your favourite activities? ").strip()
if "reading" in activities:
readingNow = input("I like reading too! What book are you reading now? ")
colour = input("What is your favourite colour? ").strip()
@davidmoten
davidmoten / scalable-data-transfer.md
Last active February 27, 2016 20:17
Scalable data transfer

#Scalable data transfer A work use case for streaming video from an aircraft to our systems had me pondering what is a good way to do this.

For starters video is nothing but a sequence of bytes so we can generalize the use case to streaming possibly large sequences of bytes to our system (where we might store it away somewhere for instance).

To help come up with a design let's start by asking how we might scale the service.

The following aspects might be scaled:

  • the number of sources streaming data to us
@davidmoten
davidmoten / aws.md
Last active October 18, 2015 10:19
Using AWS to get messages to AMSA

#Delivery of messages to AMSA via AWS This is an exploration of how one could expose a web service over https to external parties that would put messages onto AMSA's internal messaging backbone.

Components

AWS Beanstalk

  • A java application (tomcat8) using ssl on 443 is deployed to Beanstalk
  • Override the tomcat-users.xml using yaml
  • Exposes an authenticated REST endpoint (HTTP POST)
  • A submit method call on the endpoint submits validated messages onto a SQS queue in AMSA's internal xml message format (message-simplified).
@davidmoten
davidmoten / release.sh
Last active October 6, 2015 09:59
Maven release to central
##
## for pasting in .bashrc
##
function release() {
RELEASE_VERSION=$1
GPG_PASSPHRASE=$2
mvn --batch-mode release:prepare \
-Dtag=$RELEASE_VERSION \
-DreleaseVersion=$RELEASE_VERSION \
-DdevelopmentVersion=$RELEASE_VERSION.1 \
@davidmoten
davidmoten / HotAndCold.md
Last active September 16, 2015 07:54
Hot and Cold Observables

Hot and Cold Rx Observables

The definitions of Hot and Cold Observables have always seemed imprecise to me so I thought I'd see if I could sharpen the definition up a bit.

Intro to Rx characterizes them as follows:

Cold - Sequences that are passive and start producing notifications on request (when subscribed to) Hot - Sequences that are active and produce notifications regardless of subscriptions.

I find the the terms active and passive in the definitions above to be vague. Additionally a sequence that produces notifications when there are no subscribers is meaningless because it is happening unobserved. I would prefer that a Cold or Hot Observable was characterized only by what we can observe about them.