Skip to content

Instantly share code, notes, and snippets.

View rafaeldjsm's full-sized avatar
🎯
Focusing

Rafael de Jesus Silva Monteiro rafaeldjsm

🎯
Focusing
View GitHub Profile
def taskOfPairing(freq):
count = 0
marker = False
for i in freq:
if i != 0:
count += i // 2
if i % 2 != 0 and marker:
count += 1
marker = False
elif i % 2 != 0:
@jogo3000
jogo3000 / vdottii.clj
Last active July 12, 2024 10:07
Some formulas for finding equivalent performances based on a reference
;; Adaptations of equations found in Jack Daniels - Daniels' Running Formula in clojure
(import (java.lang Math))
(defn %VOmax
"Returns the percentage of VOmax a runner can sustain for the given duration"
[seconds]
(let [mins (/ seconds 60)]
(+ 0.8
(* 0.1894393
(Math/exp (* -0.012778 mins)))
@accessnash
accessnash / predictive_analytics2.py
Created September 4, 2018 00:30
Forward stepwise variable selection for logistic regression - Chapter 2 - Predictive Analytics - Datacamp
# Import the linear_model and roc_auc_score modules
from sklearn import linear_model
from sklearn.metrics import roc_auc_score
# Consider two sets of variables
variables_1 = ["mean_gift","income_low"]
variables_2 = ["mean_gift","income_low","gender_F","country_India","age"]
# Make predictions using the first set of variables and assign the AUC to auc_1
X_1 = basetable[variables_1]
@kevinluo201
kevinluo201 / tlen.lsp
Created April 28, 2018 14:23
tlen.lsp
;|
TLEN.LSP - Total LENgth of selected objects
(c) 1998 Tee Square Graphics
|;
(defun C:TLEN (/ ss tl n ent itm obj l)
(setq ss (ssget)
tl 0
########################################## Importing Data in Python (Part 2) #############################################
########################################## Importing flat files from the web: your turn! #################################
# You are about to import your first file from the web! The flat file you will import will be 'winequality-red.csv' from the University # of California, Irvine's Machine Learning repository. The flat file contains tabular data of physiochemical properties of red wine,
# such as pH, alcohol content and citric acid content, along with wine quality rating.
# The URL of the file is
@enzoftware
enzoftware / sobel-filter.py
Last active October 5, 2021 19:03
Sobel filter in Python for edge detection 🐍
from PIL import Image
import math
path = "peru.jpeg" # Your image path
img = Image.open(path)
newimg = Image.new("RGB", (width, height), "white")
for x in range(1, width-1): # ignore the edge pixels for simplicity (1 to width-1)
for y in range(1, height-1): # ignore edge pixels for simplicity (1 to height-1)
# initialise Gx to 0 and Gy to 0 for every pixel
Gx = 0
@pierdom
pierdom / distr_fitting.ipynb
Last active January 19, 2022 10:30
[Find best fitting distributions] Find the best fitting PDFs (power distribution functions) from a list of well-known distributions in scipy. Inspired by this: https://stackoverflow.com/questions/6620471/fitting-empirical-distribution-to-theoretical-ones-with-scipy-python #datascience #python #matplotlib #visualization #statistics
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@richard512
richard512 / geo-distance-calc.md
Last active November 5, 2021 03:23
Calculate distance between lat long coordinates in excel / libre calc

Using variables

=ACOS(COS(RADIANS(90-Lat1)) *COS(RADIANS(90-Lat2)) +SIN(RADIANS(90-Lat1)) *SIN(RADIANS(90-Lat2)) *COS(RADIANS(Long1-Long2))) *6371

Using Cell References

=ACOS(COS(RADIANS(90-A2)) *COS(RADIANS(90-A3)) +SIN(RADIANS(90-A2)) *SIN(RADIANS(90-A3)) *COS(RADIANS(B2-B3))) *6371

That'll work for a table set up like this:

Name Lat Long
# Respondido em: http://pt.stackoverflow.com/questions/184192
tipo_jogo = 0
def computador_escolhe_jogada(n, m):
# Vez do computador:
print("Vez do computador!")
# Pode retirar todas as peças?
@rodrigok
rodrigok / capitais.json
Created May 5, 2016 15:18
TABELA DE DISTÂNCIAS ENTRE AS CAPITAIS BRASILEIRAS EM JSON
[
"Aracajú",
"Belém",
"Belo Horizonte",
"Boa Vista",
"Brasília",
"Campo Grande",
"Cuiabá",
"Curitiba",
"Florianópolis",