Skip to content

Instantly share code, notes, and snippets.

View vinipickrodt's full-sized avatar
🏠
Working from home

vinipickrodt vinipickrodt

🏠
Working from home
  • BairesDev
  • Porto Alegre
View GitHub Profile
@danperrout
danperrout / SELIC.gs
Created June 3, 2021 16:08
API Função SELIC Google Planilhas (Sheets)
/*
* @return Retorna a taxa anual da SELIC de acordo com a data passada (se não for passada nenhuma data retorna a taxa anual do dia de hoje).
* Fonte: https://www.bcb.gov.br/estabilidadefinanceira/selicdadosdiarios
**/
function SELIC(dataConsulta = new Date()) {
var today = Utilities.formatDate(new Date(), "GMT+3", "dd/MM/yyyy");
if (dataConsulta.length == 0)
dataConsulta = new Date()
@fewlinesofcode
fewlinesofcode / ClosuresCheatSheetPG.swift
Created October 22, 2018 07:53
Playground contents for "Closures cheatsheet"
import Foundation
/*
> Closures are self-contained blocks of functionality that can be passed around and used in your code. Closures in Swift are similar to blocks in C and Objective-C and to lambdas in other programming languages. Swift’s closure expressions have a clean, clear style, with optimizations that encourage brief, clutter-free syntax in common scenarios.
For better understanding, I strongly recommend you to read the [Swift functions cheatsheet]({% post_url 2016-02-12-swift-functions-cheatsheet %}) and it's sources.
# Closure syntax
Since any function is the special case of closure, they are pretty the same. Basic difference is the way of writing and the use purpose. Closures syntax is optimized to be convenient for *inlining*, *passing as parameter* and *using as return type* of other functions.
The general form of the Swift closure is:
{ (parameters) -> ReturnType in
@PJensen
PJensen / Perceptron.cs
Last active February 28, 2019 18:49
A refactorted and object oriented version of the procedural Perceptron outlined http://www.codingvision.net/miscellaneous/c-perceptron-tutorial
public class EntryPoint
{
public static void Main(string[] args)
{
var n0 = new Perceptron(2);
do
{
n0.ResetErrorTracking();
@bzamecnik
bzamecnik / simples_lstm_softmax_classifier_keras.py
Created December 24, 2016 07:11
Simplest sequence classifier with LSTM & softmax in Keras
"""
Classifies sequences of length 10 with 20 features into 2 classes
with a single LSTM layer with 32 neurons.
See also a more involved example:
https://gist.github.com/bzamecnik/dccc1c4fdcf1c7a31757168b19c827a7
"""
from keras.layers import Input, LSTM, Dense
@siemanko
siemanko / tf_lstm.py
Last active July 26, 2023 06:57
Simple implementation of LSTM in Tensorflow in 50 lines (+ 130 lines of data generation and comments)
"""Short and sweet LSTM implementation in Tensorflow.
Motivation:
When Tensorflow was released, adding RNNs was a bit of a hack - it required
building separate graphs for every number of timesteps and was a bit obscure
to use. Since then TF devs added things like `dynamic_rnn`, `scan` and `map_fn`.
Currently the APIs are decent, but all the tutorials that I am aware of are not
making the best use of the new APIs.
Advantages of this implementation:
@stewartpark
stewartpark / xor.py
Created October 12, 2015 08:17
Simple XOR learning with keras
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.optimizers import SGD
import numpy as np
X = np.array([[0,0],[0,1],[1,0],[1,1]])
y = np.array([[0],[1],[1],[0]])
model = Sequential()
model.add(Dense(8, input_dim=2))
@maurobaraldi
maurobaraldi / bovespa_intraday.py
Last active August 11, 2024 20:31
Cotações da Bovespa Intraday
#!/usr/bin/env python
from datetime import datetime
from json import loads
from time import gmtime, mktime, strptime
# LevelDict é um wrapper usando dicionário para LevelDB
# https://github.com/maurobaraldi/leveldict
from leveldict import LevelJsonDict
from requests import get
@vorandrew
vorandrew / blackscholes.js
Created September 4, 2012 16:44 — forked from joaojeronimo/blackscholes.js
Black-Scholes in Javascript: A rewrite of http://www.espenhaug.com/black_scholes.html
/*
PutCallFlag: Either "put" or "call"
S: Stock Price
X: Strike Price
T: Time to expiration (in years)
r: Risk-free rate
v: Volatility
This is the same one found in http://www.espenhaug.com/black_scholes.html
but written with proper indentation and a === instead of == because it's