This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.monocle; | |
import java.io.IOException; | |
import org.apache.flink.api.common.state.ValueState; | |
import org.apache.flink.api.common.state.ValueStateDescriptor; | |
import org.apache.flink.streaming.api.windowing.time.Time; | |
import org.apache.flink.configuration.Configuration; | |
import org.apache.flink.util.Collector; | |
import org.apache.flink.streaming.api.functions.KeyedProcessFunction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import os | |
import time | |
from subprocess import Popen, PIPE | |
import pyarrow.parquet as pq | |
import pickle | |
import hashlib | |
TSDB_CPUS = 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def to_asyncio_in_thread(func): | |
async def wrapper(*args, **kwargs): | |
return await asyncio.get_event_loop().run_in_executor(None, lambda: func(*args, **kwargs)) | |
return wrapper | |
# Usage: | |
@to_asyncio_in_thread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cachetools import TTLCache | |
from cachetools.keys import hashkey | |
from parameterized_lock import parameterized_lock | |
def async_threadsafe_ttl_cache(func=None, ttl=60): | |
cache = TTLCache(maxsize=100, ttl=ttl) | |
def decorator(decorated_func): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cProfile | |
import io | |
import pstats | |
pr = cProfile.Profile() | |
pr.enable() | |
### Code to profile here | |
pr.disable() | |
s = io.StringIO() | |
ps = pstats.Stats(pr, stream=s).sort_stats('time') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian | |
# Adding wanted packages | |
RUN apt-get update && \ | |
apt-get install -y --fix-missing \ | |
tcpdump \ | |
bash-completion \ | |
dos2unix \ | |
telnet && \ | |
rm -rf /var/lib/apt/lists/* && \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM mdillon/postgis:11-alpine | |
ENV JSQUERY_VERSION 1.1.1 | |
RUN apk add --no-cache --virtual .fetch-deps \ | |
ca-certificates \ | |
openssl \ | |
tar \ | |
&& apk add --no-cache --virtual .build-deps \ | |
g++ \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using alpine version with glibc installed to run apps like Java | |
FROM frolvlad/alpine-glibc:alpine-3.9 | |
# Adding wanted packages | |
RUN apk add --no-cache \ | |
bash \ | |
tcpdump \ | |
bash-completion \ | |
dos2unix \ | |
busybox-extras # For telnet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
tar zxvf openjdk-11.0.2_linux-x64_bin.tar.gz | |
mv jdk-11.0.2 /usr/local | |
echo "export JAVA_HOME=/usr/local/jdk-11.0.2" >> /etc/profile.d/jdk11.sh | |
echo "export PATH=$PATH:$JAVA_HOME/bin" >> /etc/profile.d/jdk11.sh | |
source /etc/profile.d/jdk11.sh | |
java -version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function contains() { | |
local n=$# | |
local value=${!n} | |
for ((i=1;i < $#;i++)) { | |
if [ "${!i}" == "${value}" ]; then | |
echo "y" | |
return 0 | |
fi |