Skip to content

Instantly share code, notes, and snippets.

View marciok's full-sized avatar
🎯
Focusing

Marcio Klepacz marciok

🎯
Focusing
View GitHub Profile
def gradient_descent(points, b, m, learning_rate):
m_gradient = 0
b_gradient = 0
N = float(len(points))
for i in range(0, len(points)):
x = points[i, 0]
y = points[i, 1]
# Caluclating the partial derivative
def calculate_error(points, m, b):
# Error is calculated by the average distance from the points to the line
error = 0
for i in range(0, len(points)):
x = points[i, 0]
y = points[i, 1]
# Moving y to the other side of the equation
# y = mx + b -> = mx + b - y
error += (y - (m*x + b))**2
# 3.Set our hyper paremeters: epoch, learning rate, m and b.
learning_rate = 0.0001
epochs = 1000
start_m = 0
start_b = 0
import numpy as np
import csv
import matplotlib.pyplot as plt
# 1. Extract Bitcoin prices and number of Google searches.
bitcoin_interest = {}
with open('bitcoin-interest.csv') as f:
reader = csv.reader(f)
for row in reader:
function validarCPF(cpf) { 
    cpf = cpf.replace(/[^\d]+/g,'');   
    if(cpf == '') return false;
    // Elimina CPFs invalidos conhecidos   
    if (cpf.length != 11 ||
        cpf == "00000000000" ||
        cpf == "11111111111" ||
        cpf == "22222222222" ||
        cpf == "33333333333" ||
        cpf == "44444444444" ||
3EvKms7mK7Ca29AwYHJovGuHb2TPD35jmy
func palin(_ str: String) -> Bool {
guard str.characters.count > 1 else { return true }
if str.characters.first != str.characters.last {
return false
}
let subword = String(Array(str.characters)[1..<str.characters.count - 1])
return palin(subword)
}
import base64
import requests
### readme
### id_number key in dictionary must include a well-formed cpf
### request smaller than 2MB
def encode_file(file_):
v_ = open(file_, 'rb')
v_read = v_.read()
var ConvertLib = artifacts.require("./ConvertLib.sol");
var MetaCoin = artifacts.require("./MetaCoin.sol");
var Friendship = artifacts.require("./Friendship.sol");
module.exports = function(deployer) {
deployer.deploy(ConvertLib);
deployer.link(ConvertLib, MetaCoin);
deployer.deploy(MetaCoin);
deployer.deploy(Friendship, 10000000000000000000000); // Passing the total amount of coins, since our initializer method requires
};
pragma solidity ^0.4.11
contract Friendship {
mapping (address => uint256) public balanceOf;// This creates an array with all balances
string public name;
string public symbol;
uint8 public decimals;
/* Initializes contract with initial supply tokens to the creator of the contract */
function Friendship(