Skip to content

Instantly share code, notes, and snippets.

View niltonheck's full-sized avatar
I may be slow to respond.

Nilton Heck niltonheck

I may be slow to respond.
View GitHub Profile
@niltonheck
niltonheck / docker-compose.yml
Last active July 30, 2018 13:55
Docker compose file for Hadoop 2.6 (w/ 3 nodes) + Spark
### SPARK IS OPTIONAL ###
### REMOVE OR COMMENT IF YOU DO NOT NEED IT ###
### SPARK ALSO NEED SOME CONF TO WORK CORRECTLY ###
spark-master:
image: bde2020/spark-master:1.6.2-hadoop2.6
container_name: spark-master
ports:
- "8080:8080"
- "7077:7077"
environment:
#include "ThingSpeak.h"
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
EthernetClient client;
unsigned long myChannelNumber = 584073;
const char * myWriteAPIKey = "701TW43AXK9N4770";
const https = require('https');
https.get('https://thingspeak.com/channels/584073/feed.json', (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
class Node {
constructor(info) {
this.info = info;
this.leftNode = null;
this.rightNode = null;
}
insert(value) {
if(value <= this.info) {
if(this.leftNode == null) {
cd ~
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install unzip zip
wget https://dl.google.com/android/repository/commandlinetools-linux-6514223_latest.zip
unzip commandlinetools-linux-6514223_latest.zip -d cmdline-tools
mkdir Android
mv cmdline-tools ./Android/
rm commandlinetools-linux-6514223_latest.zip
sudo apt-get install -y lib32z1 openjdk-8-jdk
@niltonheck
niltonheck / trie-correcao-nomes.kts
Last active May 21, 2021 14:29
Trie: Tratamento para Correção de Nomes
import kotlin.system.measureTimeMillis
data class ClosestMatch (
val match: String,
val index: Int
)
data class Node(
var value: Char? = null,
var word: String? = null,
using System.Collections;
class ClosestMatch {
public String Match;
public Int32 Index;
public ClosestMatch(String incomingMatch, Int32 incomingIndex) {
Match = incomingMatch;
Index = incomingIndex;
}
@niltonheck
niltonheck / trie-correcao-grafia.kts
Last active June 4, 2021 17:33
Trie - Correção de Grafia
data class ClosestMatch (
val match: String,
val index: Int
)
data class Node(
var value: Char? = null,
var word: String? = null,
val children: MutableList<Node> = emptyList<Node>().toMutableList()
)
@niltonheck
niltonheck / formatName.kts
Last active June 4, 2021 17:54
Hashtable e Função para Formatação do Nome
Hashtable conversions = new Hashtable();
conversions.Add("C Manut ", "Centro Manutenção");
conversions.Add("Centro Manut ", "Centro Manutenção");
conversions.Add("C M ", "Centro Manutenção");
...
String formatName(Trie trie, String record, Hashtable conversions) {
ClosestMatch close = trie.Search(record.name, root);
if ( close != null ) {
return conversions[close.Match] + record.name.Substring(close.Index);
@niltonheck
niltonheck / running-trie.kts
Last active June 4, 2021 18:59
Execução da Árvore
Trie trie = new Trie();
Node root = new Node();
foreach (var key in conversions.Keys)
{
trie.insertIntoTrie(root, (key as String).ToArray(), 0);
}
// For de exemplo para validar performance.
for (int i = 0; i < 1000000; i++) {