Skip to content

Instantly share code, notes, and snippets.

View mxm's full-sized avatar

Maximilian Michels mxm

View GitHub Profile
@mxm
mxm / killable-entrypoint.sh
Created August 16, 2018 13:54
Use CTRL+C to kill a Docker container which runs a process in foreground
#!/bin/sh
# Using CTRL+C on a foreground Docker container is as easy as:
command &
wait
@mxm
mxm / queries.md
Last active January 9, 2018 15:59
Postgres sorted merge join vs hash join

Join Strategy

Sorted Merge with t1.size ~= t2.size

max=# explain select * from t1 join t2 on t1.col1 = t2.col1;
                            QUERY PLAN
------------------------------------------------------------------
 Merge Join  (cost=359.57..860.00 rows=32512 width=8)
   Merge Cond: (t1.col1 = t2.col1)
@mxm
mxm / gist for elias
Last active October 3, 2017 08:16 — forked from turbo-ele/gist for max
Crazy POSIX-compliant magic for passing space-containing arguments to exec
#!/bin/sh
# OPTIONS:
# -d: start the daemon in the background
# -p <filename>: log the pid to a file (useful to kill it later)
# -v: print crate version to stdout
# -h: print usage information
# -D: set a java system property value
# -C: set a Crate property value
# -X: set a nonstandard java option
@mxm
mxm / github_load_diffs.js
Created September 8, 2017 11:50
Loads all the diffs which are hidden on the GitHub "Files changed"
var buttons = document.getElementsByClassName("load-diff-button");
for (var i=0; i < buttons.length; i++) {
buttons[i].click();
}
@mxm
mxm / MultiSourceWindowCoGroupTest.java
Last active November 23, 2016 14:40 — forked from saarw/MultiSourceWindowCoGroupTest.java
MultiSourceWindowCoGroupTest
import com.google.common.annotations.VisibleForTesting;
import org.apache.flink.api.common.functions.CoGroupFunction;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.functions.ReduceFunction;
import org.apache.flink.api.common.state.ReducingState;
import org.apache.flink.api.common.state.ReducingStateDescriptor;
import org.apache.flink.api.common.typeutils.base.LongSerializer;
import org.apache.flink.api.java.functions.KeySelector;
import org.apache.flink.api.java.tuple.Tuple;
import org.apache.flink.api.java.tuple.Tuple2;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
@mxm
mxm / ZeroElementEmittingSlidingWindowOperator.java
Last active October 26, 2016 17:11
ZeroElementEmittingSlidingWindowOperator
package org.myorg.quickstart;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
*
@mxm
mxm / CustomTrigger.java
Created October 18, 2016 13:53
A custom Trigger implementation for Flink 1.1.3 which triggers 1) a window computation on every element 2) doesn't emit duplicate window outputs 3) sends out a special -1 element when a timeout occurs.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
@mxm
mxm / deb-contents.txt
Last active April 2, 2016 18:33
Bigtop Flink binary RPM/Debian package contents
drwxr-xr-x root/root 0 2016-04-02 20:22 ./
drwxr-xr-x root/root 0 2016-04-02 20:22 ./usr/
drwxr-xr-x root/root 0 2016-04-02 20:22 ./usr/share/
drwxr-xr-x root/root 0 2016-04-02 20:22 ./usr/share/doc/
drwxr-xr-x root/root 0 2016-04-02 20:22 ./usr/share/doc/flink/
-rw-r--r-- root/root 5823 2016-04-02 20:22 ./usr/share/doc/flink/LICENSE.gz
-rw-r--r-- root/root 1308 2016-04-02 20:22 ./usr/share/doc/flink/README.txt
-rw-r--r-- root/root 411 2016-04-02 20:04 ./usr/share/doc/flink/copyright
-rw-r--r-- root/root 128 2016-04-02 20:04 ./usr/share/doc/flink/changelog.Debian.gz
-rw-r--r-- root/root 779 2016-04-02 20:22 ./usr/share/doc/flink/NOTICE
/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java -Didea.launcher.port=7534 "-Didea.launcher.bin.path=/opt/homebrew-cask/Caskroom/intellij-idea-ce/15.0/IntelliJ IDEA 15 CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/