Skip to content

Instantly share code, notes, and snippets.

View joao-parana's full-sized avatar

João Antonio Ferreira joao-parana

View GitHub Profile
@joao-parana
joao-parana / BasicAuthenticationFilter.java
Created October 10, 2017 14:26 — forked from neolitec/BasicAuthenticationFilter.java
HTTP Basic authentication Java filter
package com.neolitec.examples;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@joao-parana
joao-parana / hello.html
Last active December 18, 2017 19:04
SOMA 01 - Hello World
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="SOMA 01 - Hello World">
<title>SOMA 01 - Hello World</title>
</head>
<body>
<script src="https://d3js.org/d3.v4.min.js" charset="utf-8"></script>
<script>
@joao-parana
joao-parana / index.html
Last active December 19, 2017 03:21
Exemplo simples com select
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="SOMA 01 - Hello World">
<title>SOMA 01 - Hello World</title>
</head>
<body>
<div id="page"></div>
<script src="https://d3js.org/d3.v4.min.js" charset="utf-8"></script>
@joao-parana
joao-parana / index.html
Last active December 19, 2017 11:28
SOMA 02 - data binding
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="data-binding">
</head>
<body>
<script src="https://d3js.org/d3.v4.min.js" charset=" utf-8"></script>
<script>
var selector = d3.select('body')
.selectAll('span')
@joao-parana
joao-parana / map-pushdow.sc
Last active April 20, 2018 19:15
Using CatalystExtension Points in Spark
// Este script é para rodar no Ammonite.
// Crie o arquivo catalyst_04.sc com este conteúdo
// Dentro da shell REPL do Ammonitem, você deve invocar assim:
// import $file.catalyst_04, catalyst_04._
//
// Mas antes execute estes tres comandos abaixo
// import coursier.MavenRepository
// interp.repositories() ++= Seq(MavenRepository("file:/Users/admin/.m2/repository"))
// import $ivy.`org.apache.spark::spark-sql:2.3.0`
@joao-parana
joao-parana / .block
Created March 28, 2018 14:29 — forked from mbostock/.block
Chord Diagram
license: gpl-3.0
height: 960
border: no
# Usando o Kubernetes com Docker in Docker (DIND)
sudo mkdir -p /usr/local
cd /usr/local
sudo mkdir dind-cluster
cd dind-cluster/
sudo chmod o+w .
ls -lat .. | head
# wget https://cdn.rawgit.com/kubernetes-sigs/kubeadm-dind-cluster/master/fixed/dind-cluster-v1.10.sh
curl -O https://cdn.rawgit.com/kubernetes-sigs/kubeadm-dind-cluster/master/fixed/dind-cluster-v1.10.sh
def happyEmployees(salary: Int) => salary > 2200
def smartTextCase(name: String) => name.toUpperCase()
import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.SparkSession.Builder
import org.apache.spark.SparkContext
import org.apache.log4j.{Level, Logger}
// A sparkSession é provida pelo proprio Spark Shell
// O nivel de log também já é configurado pela Spark Shell
def boolean_udf_wrapper(a:String, b:String, t:Any): Boolean = { true }
def string_udf_wrapper(a:String, b:String, t:Any): String = { "••••" }
import org.apache.spark.sql.functions.expr
import org.apache.spark.sql.functions.sum