Skip to content

Instantly share code, notes, and snippets.

View fernandojunior's full-sized avatar

Fernando Felix fernandojunior

View GitHub Profile
@fernandojunior
fernandojunior / sufixos
Created May 2, 2020 08:39 — forked from vgeorge/sufixos
Importação IBGE Censo 2010 - Resultados do Universo
AC
AL
AM
AP
BA
CE
DF
ES
GO
MA
@fernandojunior
fernandojunior / k_custom.py
Last active March 27, 2020 23:33
Perform data clustering using any distance or centroid metric as euclidian or cosine distance and median or mean centroid
# adapted from https://pythonprogramming.net/k-means-from-scratch-machine-learning-tutorial/
from sklearn import datasets
import numpy as np
from scipy import spatial
euclidian_distance = lambda a, b: np.linalg.norm(a - b)
cosine_distance = lambda a, b: spatial.distance.cosine(a, b)
class KCustom:
@fernandojunior
fernandojunior / gist:b4e587f5aaf29be16827e087065f103b
Last active October 2, 2019 13:55
read lines from zipped file stored in google cloud file system
import zipfile
import gcsfs
fs = gcsfs.GCSFileSystem(project='project-name')
with fs.open('file.zip') as f:
z = zipfile.ZipFile(f)
for filename in z.namelist():
if not os.path.isdir(filename):
@fernandojunior
fernandojunior / arbitrage.py
Created May 23, 2018 01:26 — forked from Valian/arbitrage.py
Short script for finding Binance Triangle arbitrage opportunities - requires python-binance installed
from collections import defaultdict
from operator import itemgetter
from time import time
from binance.client import Client
FEE = 0.0005
PRIMARY = ['ETH', 'USDT', 'BTC', 'BNB']
@fernandojunior
fernandojunior / .eslintrc.json
Last active May 19, 2018 01:50
ohlcv challenge
{
"extends": "standard"
}
install.packages("nortest")
# install and import package needed for normality measures
install.packages("moments")
normality_measuares <- function (data) {
require("moments")
print(paste("skewness=", skewness(data), sep=""))
print(paste("kurtosis=", kurtosis(data), sep=""))
}
@fernandojunior
fernandojunior / gistFile.js
Created July 13, 2017 19:06
Handle monitor(s) changes in Windows
const { spawn } = require('child_process');
/**
* Handle monitor(s) changes, ig, perform an action when a monitor is connected or disconnected.
*
* Notes:
* - Windows implementation is based on Windows Management Interface (WMI) and WMI Query Language (WQL)
*
* Reference:
* - https://stackoverflow.com/questions/5278860/using-wmi-to-identify-which-device-caused-a-win32-devicechangeevent
@fernandojunior
fernandojunior / gist:990d4cea9281db1ee3ea7462e2a61e07
Created February 17, 2017 12:47
sparse checkout clone submodules git
http://askubuntu.com/questions/460885/how-to-clone-git-repository-only-some-directories
http://www.richsomerfield.com/post/2014-03-05-adventures-in-git-sparsecheckouts/
http://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository/13738951#13738951
https://dzone.com/articles/reactjs-and-spring-data-rest-security
https://bitbucket.org/moondowner/facebook-react-thymeleaf-spring-mvc-example/src
https://spring.io/blog/2015/09/01/react-js-and-spring-data-rest-part-1-basic-features
http://todomvc.com/examples/react/#/
@fernandojunior
fernandojunior / gist:42292d228fed3495e634dec6291c6946
Last active January 4, 2017 15:42
naming conventions programming
http://www.english-for-students.com/FormationofWords.html
http://www.gingersoftware.com/content/grammar-rules/nouns/compound-nouns/
http://pt.stackoverflow.com/questions/301/devo-escrever-meu-programa-em-ingl%C3%AAs-ou-portugu%C3%AAs
https://dzone.com/articles/best-practices-variable-and
https://www.python.org/dev/peps/pep-0008/#naming-conventions
https://gist.github.com/sloria/7001839