Skip to content

Instantly share code, notes, and snippets.

View leonardonsantos's full-sized avatar

Leonardo Santos leonardonsantos

  • volvo-cars
  • Stockholm - SE
  • 13:43 (UTC +02:00)
View GitHub Profile
@leonardonsantos
leonardonsantos / eleicoes2022.ipynb
Last active November 13, 2022 17:16
eleicoes2022.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@leonardonsantos
leonardonsantos / googlecolabscalaspark.ipynb
Last active November 13, 2022 17:16
googlecolabscalaspark.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@leonardonsantos
leonardonsantos / docker-compose.yml
Created November 7, 2022 16:01
Docker Zeppelin Spark
version: '3'
services:
spark:
image: docker.io/bitnami/spark:2.4.5
environment:
- SPARK_MODE=master
- SPARK_RPC_AUTHENTICATION_ENABLED=no
- SPARK_RPC_ENCRYPTION_ENABLED=no
- SPARK_LOCAL_STORAGE_ENCRYPTION_ENABLED=no
- SPARK_SSL_ENABLED=no
---
- hosts: localhost
connection: local
gather_facts: no
vars:
var_name: "william"
var_port: "80"
tasks:
@leonardonsantos
leonardonsantos / asana.gs
Created November 26, 2018 14:14
Google Spreadsheets (sheets) script to get data from Asana API
// returns tagId
function asanaTagByName(tagName, token) {
var url = "https://app.asana.com/api/1.0/workspaces/2653227806782/typeahead?type=tag&query=" + encodeURIComponent(tagName);
var options = {
"muteHttpExceptions": true,
"method": "get",
"headers": {
"Authorization": "Bearer " + token
}
@leonardonsantos
leonardonsantos / heapedMap.scala
Created November 18, 2018 20:51
An Mutable PriorityQueue that allows random acces to elements and allows changins values
import scala.annotation.tailrec
import scala.collection.mutable.{ArrayBuffer, Map}
import scala.util.Try
class HeapedMap[K, V] (implicit ord: Ordering[V]){
val dict = Map[K,Int]() // Keeps index of key withing vector
val vector = ArrayBuffer[(K,V)]()
override def toString(): String = vector.toString
def toMap(): scala.collection.immutable.Map[K,V] = dict.mapValues(vector(_)._2).toMap
@leonardonsantos
leonardonsantos / test_later.js
Last active January 29, 2016 15:05
npm later bug
var later = require('later');
var timeString = "0 * * * *";
function nextSchedule(cronTimeString, cont){
var schedule = later.parse.cron(cronTimeString, true);
later.date.localTime()
var results = later.schedule(schedule).next(cont);
return(results);
}
#!/usr/bin/nodejs
var levelup = require('levelup');
var http = require("http");
var stream = require('stream');
var util = require('util');
var Transform = stream.Transform || require('readable-stream').Transform;
var server = http.createServer(onRequest);