Skip to content

Instantly share code, notes, and snippets.

View fabiogaluppo's full-sized avatar

Fabio Galuppo fabiogaluppo

View GitHub Profile
@fabiogaluppo
fabiogaluppo / gist:66d0563227c9bcb9915233ee438b31c3
Last active July 20, 2018 01:08
Built-in Types in Python (Elementary Data Structures)
# http://bit.ly/py-eds-1
import hashlib
"""
>>> cut ("HelloWorld", 5)
('Hello', 'World')
"""
def cut(msg, cut_point):
return (msg[:cut_point], msg[cut_point:])
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fabiogaluppo
fabiogaluppo / Encrypt and Decrypt with Hill Cipher.ipynb
Last active August 1, 2018 01:19
Encrypt and Decrypt with Hill Cipher
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fabiogaluppo
fabiogaluppo / Compute Fisher Linear Discriminant.ipynb
Created August 2, 2018 02:12
Compute Fisher Linear Discriminant
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fabiogaluppo
fabiogaluppo / coinsChange.py
Created April 29, 2020 14:25
Coin change problem in Python (Greedy and DP)
def greedyCoinsChange(A, C):
C.sort(reverse = True)
counter = 0
for c in C:
if (A > 0):
counter = counter + (A // c)
A = A % c
else:
break
return counter
@fabiogaluppo
fabiogaluppo / webscraping_megasena.fs
Created April 25, 2021 23:25
Web Scraping "Mega Sena" with F# Data Providers
open FSharp.Data
[<Literal>]
let MegaSena_Url = "http://loterias.caixa.gov.br/wps/portal/loterias/landing/megasena/!ut/p/a1/04_Sj9CPykssy0xPLMnMz0vMAfGjzOLNDH0MPAzcDbwMPI0sDBxNXAOMwrzCjA0sjIEKIoEKnN0dPUzMfQwMDEwsjAw8XZw8XMwtfQ0MPM2I02-AAzgaENIfrh-FqsQ9wNnUwNHfxcnSwBgIDUyhCvA5EawAjxsKckMjDDI9FQE-F4ca/dl5/d5/L2dBISEvZ0FBIS9nQSEh/pw/Z7_HGK818G0K8DBC0QPVN93KQ10G1/res/id=historicoHTML/c=cacheLevelPage/=/"
type MegaSena_Results = HtmlProvider<MegaSena_Url, PreferOptionals=true>
let instanceMegaSena = MegaSena_Results.GetSample()
let data = instanceMegaSena.Tables.Table1
for x in data.Rows do
@fabiogaluppo
fabiogaluppo / fnv1_bench.cpp
Last active August 11, 2023 22:09
FNV-64 fnv1 hash Quick C++ Benchmarks
//Quick C++ Benchmarks link: https://quick-bench.com/q/mvKK4FzyZGTNSFr5Qe6i1akzzro
#include <cstddef>
#include <unordered_map>
#include <string>
#include <utility>
static const std::uint64_t FNV1_64_INIT = 0xcbf29ce484222325ULL;
//FNV-1 hash