Skip to content

Instantly share code, notes, and snippets.

View jruizvar's full-sized avatar

Jose Cupertino Ruiz Vargas jruizvar

View GitHub Profile
@jruizvar
jruizvar / PuttyGithub.md
Last active August 6, 2023 20:27
Connect to Github using Putty

Setup SSH key to connect to Github with Putty

Open git bash and execute

ssh-keygen -t rsa -b 4096 -C "jruizvar@cern.ch"

This procedure generates two files: .ssh/id_rsa and .ssh/id_rsa.pub. Add public key to Github.

Setup SSH agent

@jruizvar
jruizvar / InstallOpenCV.md
Last active February 27, 2021 12:53
Building OpenCV 3.2.0 from source on macOS Sierra with Python 3 support

Building OpenCV 3.2.0 from source with Python 3 support

Install OpenCV on macOS Sierra enabling Python 3 with the following instructions:

  • Install CMake, Python 3 + Numpy in advance
  • Download latest OpenCV source code (https://github.com/opencv/opencv/releases)
  • Move the folder opencv-3.2.0 to the current directory
  • In the current directory, execute the following steps:
mkdir build
""" SQL Code Generator.
Analisa as regras de uma árvore de decisão ajustada pelos modelos
Random Forest ou Gradient Boosted do Spark, para gerar o
correspondente código em SQL.
O conjunto de árvores pode ser extraido com o método `toDebugString`
e formatado como uma lista:
>> ensemble = model.trees
DROP TABLE IF EXISTS
dados;
CREATE TEMPORARY TABLE
dados
(
cnpj INT,
anomes INT,
sinal FLOAT
);
@jruizvar
jruizvar / pivot_hive_table.hql
Last active May 16, 2019 01:17
Filtra empresas com historico complete, calcula o acumulado, e pivota o resultado.
DROP TABLE IF EXISTS temp1;
CREATE TABLE temp1 (anomes INT, cnpj STRING, x DOUBLE);
INSERT INTO temp1 VALUES
(201801, 'c0', 1),
(201801, 'c1', 1),
(201801, 'c2', 3),
(201802, 'c0', 2),
(201802, 'c1', 2),
@jruizvar
jruizvar / cumulative_sum.hql
Last active May 16, 2019 00:31
Filtra empresas com historico completo, e calcula o sinal acumulado.
DROP TABLE IF EXISTS temp1;
CREATE TABLE temp1 (anomes INT, cnpj STRING, x DOUBLE);
INSERT INTO temp1 VALUES
(201801, 'c0', 1),
(201801, 'c1', 1),
(201801, 'c2', 3),
(201802, 'c0', 2),
(201802, 'c1', 2),
@jruizvar
jruizvar / remove_duplicates.hql
Last active May 5, 2019 02:34
Remove duplicated rows and add a partition in a hive table
CREATE TABLE temp1 (anomes INT, cnpj STRING, feat0 STRING, feat1 STRING);
INSERT INTO temp1 VALUES
(201901, '0', 'x', 'a'),
(201901, '0', 'y', 'b'),
(201901, '1', 'v', 'c'),
(201901, '1', 'w', 'd'),
(201902, '0', 'x', 'a'),
(201902, '0', 'x', 'a'),
(201902, '1', 'y', 'b'),
@jruizvar
jruizvar / IntelPython.md
Last active July 2, 2017 01:18
Intel Python on Windows 10

Python environment using the Intel package repository

Download and install Miniconda

https://conda.io/miniconda.html

Open Anaconda Prompt

conda update conda
conda config --add channels intel