Skip to content

Instantly share code, notes, and snippets.

View jelmerk's full-sized avatar

Jelmer Kuperus jelmerk

View GitHub Profile
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
public class Foo {
ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock();
ReentrantReadWriteLock.ReadLock readLock = readWriteLock.readLock();
ReentrantReadWriteLock.WriteLock writeLock = readWriteLock.writeLock();
import breeze.linalg._
import breeze.linalg.eig.Eig
import breeze.numerics._
import org.apache.spark.ml.clustering.KMeans
import org.apache.spark.ml.linalg.{Vectors, DenseVector => SparkDenseVector, Vector => SparkVector}
import com.holdenkarau.spark.testing.DataFrameSuiteBase
import org.scalatest.FunSuite
import org.eclipse.collections.api.map.primitive.IntIntMap;
import org.eclipse.collections.api.map.primitive.MutableIntIntMap;
import org.eclipse.collections.api.map.primitive.MutableIntObjectMap;
import org.eclipse.collections.impl.map.mutable.primitive.IntIntHashMap;
import org.eclipse.collections.impl.map.mutable.primitive.IntObjectHashMap;
import java.io.*;
import java.util.*;
/**
@jelmerk
jelmerk / Solution.scala
Last active December 2, 2023 07:50
Advent of spark
import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.functions._
object Foo extends App {
val spark = SparkSession.builder().master("local[*]").getOrCreate()
import spark.implicits._
spark.read.text("/Users/jkuperus/dev/playground/advent-of-code-2023/scala/src/main/resources/day2/input_a.txt")