Skip to content

Instantly share code, notes, and snippets.

@asubb
asubb / wave-blog:using-jupyter:imports.kt
Created April 10, 2020 20:31
wave-blog/using-jupyter/imports.kt
%use lets-plot
@file:Repository("https://dl.bintray.com/wavebeans/wavebeans")
@file:DependsOn("io.wavebeans:lib:0.0.3")
import io.wavebeans.lib.*
import io.wavebeans.lib.io.*
import io.wavebeans.lib.math.*
import io.wavebeans.lib.stream.*
import io.wavebeans.lib.stream.fft.*
@asubb
asubb / wave-blog:using-jupyter.Dockerfile
Last active May 20, 2020 03:16
wave-blog/using-jupyter/dockerfile
FROM jupyter/base-notebook
USER root
# Install OpenJDK-8
RUN apt-get update && \
apt-get install -y openjdk-8-jdk && \
apt-get install -y ant && \
apt-get clean;
@asubb
asubb / compressHash.kt
Last active January 22, 2020 15:35
Hash values are in fact very long number written as hex number. For using it as string it is sometimes waste of space (i.e. as identifier or something). That function kinda compresses the string by using more digits for this number. How many digits? It's up to you.
import kotlin.math.max
import kotlin.random.Random
fun compressHash(hexV: String, digits: String = "0123456789abcdefghijklmnopqrstuvwxyz"): String {
val hexDigits = "0123456789abcdef"
val zero = hexDigits.first()
fun dropLeadingZeros(hexV: String): String {
var v = hexV