Skip to content

Instantly share code, notes, and snippets.

View zorteran's full-sized avatar

Maciej Szymczyk zorteran

View GitHub Profile
package pl.wiadrodanych.demo.base
import org.apache.spark.sql.SparkSession
trait SparkJob {
val spark: SparkSession = SparkSession
.builder
.appName("SomeApp")
.master("local[*]")
.getOrCreate()
private def sumByNormalizedName(normalizedFruits: DataFrame, spark: SparkSession) = {
import spark.implicits._
val sumOfFruits = normalizedFruits
.groupBy("normalized_name")
.agg(
sum(($"quantity")).as("sum")
)
sumOfFruits
}
def main(args: Array[String]) {
val spark = SparkSession
.builder
.appName("MyAwesomeApp")
.master("local[*]")
.getOrCreate()
import spark.implicits._
val groceries: DataFrame = getGroceries
val spark = SparkSession
.builder
.appName("MyAwesomeApp")
.master("local[*]")
.getOrCreate()
import spark.implicits._
val groceries = spark.read
.option("inferSchema", "true")
@zorteran
zorteran / spylon_doesnt_work.ipynb
Created September 5, 2020 18:05
Spylon kernel doesn't like MongoDB connector.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zorteran
zorteran / seed_mysql.ipynb
Created September 5, 2020 18:03
Write some data to MySQL
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zorteran
zorteran / seed_mongo.ipynb
Created September 5, 2020 18:02
Write some data to MongoDB
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zorteran
zorteran / simple_etl_to_cassandra.ipynb
Created September 5, 2020 18:00
Simple ETL joining data from MySQL and MongoDB and wriiting to Cassandra
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zorteran
zorteran / keepalived.conf
Created July 6, 2020 04:38
Keepalived script + logstash check
global_defs {
enable_script_security
}
vrrp_script chk_logstash {
script "/etc/keepalived/lol.sh" # path of the script to execute
interval 1 # seconds between script invocations
timeout 1 # seconds after which script is considered to have failed
@zorteran
zorteran / logstash_check.sh
Last active August 29, 2020 06:27
Checking if logstash is alive
#!/bin/bash
logstash_response="$(curl --silent localhost:9600)"
if echo $logstash_response | grep -q '"status":"green"'
then
echo "Logstash is green. It's ok :-)"
exit 0
else
echo "Logstash is not green :-( plz help"
exit 1
fi