Skip to content

Instantly share code, notes, and snippets.

View kellen's full-sized avatar
🏴
🔥🔥🔥

kellen

🏴
🔥🔥🔥
View GitHub Profile
@kellen
kellen / bf.scala
Last active February 16, 2024 19:11
Scalable Bloom Filter Size
// https://gsd.di.uminho.pt/members/cbm/ps/dbloom.pdf
def bfSizeSummary(initialCapacity: Long, numFilters: Int = 10, initialFpProb: Double = 0.03, tighteningRatio: Double = 0.9, growthRate: Int = 2) = {
case class FilterInfo(fpProb: Double, capacity: Double, bits: Double)
case class Out(cumulative: FilterInfo, summary: List[String])
println(
Range(0, numFilters)
.map { i =>
val fpProb = initialFpProb * scala.math.pow(tighteningRatio, i)
val capacity = initialCapacity * scala.math.pow(growthRate, i)
val bits = -1 * capacity * scala.math.log(fpProb) / scala.math.pow(scala.math.log(2), 2)
@kellen
kellen / Fail.scala
Created January 28, 2022 05:28
Beam NPE during test
package org.apache.beam.sdk.options
import org.scalatest.funsuite.AnyFunSuite
import org.apache.beam.sdk.options.ValueProvider.StaticValueProvider
import org.apache.beam.sdk.testing.TestPipeline
import org.apache.beam.sdk.testing.TestPipeline.TestValueProviderOptions
import java.util
trait Fail {
def boom(): Unit = {

Keybase proof

I hereby claim:

  • I am kellen on github.
  • I am kellen (https://keybase.io/kellen) on keybase.
  • I have a public key whose fingerprint is D49D 3BDE 4DE8 B04B EF9F 640F BCF7 E81D DAC4 7155

To claim this, I am signing this object:

#!/bin/bash
# This is a wrapped up version of the instructions at
# http://code.google.com/p/irssi-libnotify/wiki/MainPage for ubuntu
#
# Usage: Just run this script from the command line with no arguments
#
# Tested on Ubuntu 12.04.1 (64 bit)
echo ""