Skip to content

Instantly share code, notes, and snippets.

Avatar

Marcio Klepacz marciok

View GitHub Profile
View webmotors-api.rb
require 'http'
require 'base64'
# HTTP monkeypatch in onder to preserve the keys on the headers.
# This is to avoid client_id to become client-id (WRONG)
module DontNormalizeUnderscoreHeaders
def normalize_header(name)
return name if name.include?('_')
View webmotors.md
View kmltest.kml
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Folder>
<name>Lugares temporários</name>
<open>1</open>
</Folder>
</kml>
View alb-ingress-controller.yml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-alb
labels:
app: my-app
annotations:
kubernetes.io/ingress.class: "alb"
alb.ingress.kubernetes.io/scheme: "internet-facing"
alb.ingress.kubernetes.io/target-type: "instance"
View my-nginx-ingress.yml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-nginx-ingress
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: myhost.mydomain.org
View btc-prices-5.py
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:
View btc-prices-4.py
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
View btc-prices-3.py
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
View btc-prices-2.py
# 3.Set our hyper paremeters: epoch, learning rate, m and b.
learning_rate = 0.0001
epochs = 1000
start_m = 0
start_b = 0
View btc-prices-1.py
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:
You can’t perform that action at this time.