Skip to content

Instantly share code, notes, and snippets.

View leocb's full-sized avatar

Leo Bottaro leocb

  • Oracle
  • Brasil
  • 05:11 (UTC -03:00)
View GitHub Profile
@leocb
leocb / LinearRegression.cs
Last active August 29, 2023 00:52
Simple C# Linear Regression Class
// Based on https://gist.github.com/NikolayIT/d86118a3a0cb3f5ed63d674a350d75f2
// With some tweaks
// This file is licensed under MIT license
public class LinearRegression
{
public static double MinimumLength { get; } = 3;
public double Average { get; private set; } = 0;
public double R2 { get; private set; } = 1;
public double Slope { get; private set; } = 0;
@leocb
leocb / pointers.md
Last active December 4, 2019 14:57
C Cheatsheets

C pointers Cheatsheet

Increment / Decrement

Pointer action Memory Address Memory Contents
p Yes, it's an address No, this returns the address
*p No, this dereferenced the pointer Yes, this returns the value at that address
*p++ Incremented after value is read Unchanged
*(p++) Incremented after value is read Unchanged
@leocb
leocb / Trello Frost Lists background.md
Last active March 20, 2019 19:01
Trello Frost Lists background

Instructions are only for Chrome

Enable Experimental Web Platform Features

Copy and paste this on your chrome URL/searchbar thingy:

chrome://flags/#enable-experimental-web-platform-features Then Enable the feature

Install Stylebot chrome extension

@leocb
leocb / Line intersection in javascript
Last active March 29, 2018 20:42
Detect if two lines are intersecting in javascript, if so, return the coordinates of the intersection. Original code in C by Paul Bourke
// line intercept math by Paul Bourke http://paulbourke.net/geometry/pointlineplane/
// Determine the intersection point of two line segments
// Return FALSE if the lines don't intersect
function intersect(x1, y1, x2, y2, x3, y3, x4, y4) {
// Check if none of the lines are of length 0
if ((x1 === x2 && y1 === y2) || (x3 === x4 && y3 === y4)) {
return false
}
@leocb
leocb / bins.md
Last active May 21, 2024 22:10
Common credit card BINs for Brazil

BIN for most common credit cards in Brazil

⚠️ For anyone using this, please note that this file is from 2015 and may be out of date or may not include all current BINs

BINs (Bank Identification Number) are the first 6 digits of a credit card. these are being distributed around the world all the time, this gist tries to list all possible ranges for the most common brazilian credit cards. Please help me keep it updated 😄

note: All length fields refer to the max length

Sources

// Como usar:
// Copie todo esse codigo
// abra o site do inmet: http://www.inmet.gov.br/sim/cond_reg/tempoCapitais.php
// aperte F12, vá na aba console, cole o codigo a aperte enter
// Defina as datas de inicio e fim nos campos que aparecem na tela
// Clique em 'buscar dados'
// Aguarde o fim do processo
// Clique no link gerado para fazer donwload do arquivo