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
object Rotation extends App { | |
val matrix = Array(Array(1,2), Array(3,4), Array(5,6)) | |
print(matrix) | |
print(transpose(matrix)) | |
print(rotate90(matrix)) | |
print(rotateMinus90(matrix)) | |
def transpose(matrix: Array[Array[Int]]): Array[Array[Int]] = { |
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
implicit class StringExtension(s: String) { | |
implicit def safeSubstring(start: Int, end: Int = 0): String = { | |
if (start < 0) { | |
var realStart = s.length - Math.abs(start) | |
var realEnd = end match { | |
case 0 => s.length | |
case e if e < 0 || e + realStart > s.length => s.length | |
case _ => realStart + end | |
} |
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 java.io.InputStream | |
import org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils | |
import org.apache.spark.sql.{ DataFrame, Row } | |
import org.postgresql.copy.CopyManager | |
import org.postgresql.core.BaseConnection | |
val jdbcUrl = s"jdbc:postgresql://..." // db credentials elided | |
val connectionProperties = { |
If you would like to persist data from your ECS containers, i.e. hosting databases like MySQL or MongoDB with Docker, you need to ensure that you can mount the data directory of the database in the container to volume that's not going to dissappear when your container or worse yet, the EC2 instance that hosts your containers, is restarted or scaled up or down for any reason.
Don't know how to create your own AWS ECS Cluster? Go here!
Sadly the EC2 provisioning process doesn't allow you to configure EFS during the initial config. After your create your cluster, follow the guide below.
If you're using an Alpine-based Node server like duluca/minimal-node-web-server follow this guide:
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
Notes from Coursera course 'Functional Programming Principles in Scala": | |
https://class.coursera.org/progfun-004 | |
✔ Week 1: Functions & Evaluations @done (14-05-01 17:20) | |
✔ Lecture 1.1 - Programming Paradigms (14:32) @done (14-04-27 17:54) | |
3 paradigms: imperative, functional, logic | |
OO: orthogonal | |
imperative: |
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 test | |
import org.apache.spark.rdd.RDD | |
import org.apache.spark.sql.SparkSession | |
import scala.collection.mutable | |
class DisjointSet() extends Serializable { | |
private val parentMap = mutable.Map[Int, Int]() |
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
# Remove anything linked to nvidia | |
sudo apt-get remove --purge nvidia* | |
sudo apt-get autoremove | |
#install important lib's | |
sudo apt-get install openjdk-8-jdk git python-dev python3-dev python-numpy python3-numpy build-essential python-pip python3-pip python-virtualenv swig python-wheel libcurl3-dev curl python python3 gcc g++ | |
# Search for your driver | |
apt search nvidia |