Skip to content

Instantly share code, notes, and snippets.

@junqueira
junqueira / spark-cluster.yaml
Created March 13, 2021 23:36 — forked from MBtech/spark-cluster.yaml
Spark Cluster on Kubernetes with History Server
# Default values for spark-services.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
tags:
livy: true
historyserver: true
jupyterhub: false
nameOverride: ""
!WSL commands:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2
!Ubuntu GUI commands:
sudo apt update && sudo apt -y upgrade
sudo apt-get purge xrdp
sudo apt install -y xrdp
sudo apt install -y xfce4
_Uma lista dos comandos Git mais usados_
## Obtendo & Criação de Projetos
| Comando | Descrição |
| ------- | --------- |
| `git init` | Inicializa um repositório Git local |
| `git clone ssh://git@github.com/[usuario]/[nome-repositorio].git` | Cria uma cópia local de um repositório remoto |
### Básicos
@junqueira
junqueira / AkkaStreamSparkIntegration.scala
Created November 22, 2020 03:06 — forked from lloydmeta/AkkaStreamSparkIntegration.scala
Example for how to connect Akka Stream and Spark Streaming by turning creating a Flow element that feeds into an InputDstream
import akka.actor._
import akka.stream.scaladsl.Flow
import org.apache.spark.streaming.dstream.ReceiverInputDStream
import org.apache.spark.streaming.receiver.ActorHelper
import akka.actor.{ ExtensionKey, Extension, ExtendedActorSystem }
import scala.reflect.ClassTag
object AkkaStreamSparkIntegration {
import scala.util.{Try, Success, Failure}
def f(s: String): Try[Int] = Try { s.toInt }
def g(i: Int): Try[Int] = Try { i * 2 }
def unit[T](v: T): Try[T] = Success(v)
//val v = "1"
val v = "bad"
val m = Success(v)
@junqueira
junqueira / gist:7349c4de295f5d4e7ed55793c34e2283
Created October 28, 2020 23:23 — forked from malzzz/gist:15639fc36d069490b7709be2f3a4d522
Install Scala 2.12.3 and SBT using apt-get on Ubuntu 16.04
## Java
sudo apt-get update
sudo apt-get install default-jdk
## Scala
sudo apt-get remove scala-library scala
sudo wget https://downloads.lightbend.com/scala/2.12.3/scala-2.12.3.deb
sudo dpkg -i scala-2.12.3.deb
sudo apt-get update
sudo apt-get install scala
@junqueira
junqueira / gist:c66c312855dae631e48fc4c646bff629
Created October 28, 2020 23:23 — forked from malzzz/gist:15639fc36d069490b7709be2f3a4d522
Install Scala 2.12.3 and SBT using apt-get on Ubuntu 16.04
## Java
sudo apt-get update
sudo apt-get install default-jdk
## Scala
sudo apt-get remove scala-library scala
sudo wget https://downloads.lightbend.com/scala/2.12.3/scala-2.12.3.deb
sudo dpkg -i scala-2.12.3.deb
sudo apt-get update
sudo apt-get install scala
@junqueira
junqueira / one_liner.sh
Created October 2, 2020 21:41 — forked from zparnold/one_liner.sh
A simply script to delete all failed pods from Kubernetes
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
@junqueira
junqueira / one_liner.sh
Created October 2, 2020 21:41 — forked from zparnold/one_liner.sh
A simply script to delete all failed pods from Kubernetes
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
@junqueira
junqueira / scala_base64_encode_decode.scala
Created September 29, 2020 17:06 — forked from frgomes/scala_base64_encode_decode.scala
Scala - Base64 encode/decode
// Base64 encode
val text = "This is plaintext."
val bytesEncoded = java.util.Base64.getEncoder.encode(text.getBytes())
// Base64 decode
val textDecoded = new String(java.util.Base64.getDecoder.decode(bytesEncoded))
println(textDecoded)