Skip to content

Instantly share code, notes, and snippets.

View diegomrodz's full-sized avatar

Diego Rodrigues diegomrodz

  • ModClima
  • Brazil, São Paulo
View GitHub Profile
@diegomrodz
diegomrodz / softmax.py
Created February 28, 2017 13:25
Computing the softmax function given an array of number of n-dimension. And how to plot it and see that all probabilities sum to one.
import numpy as np
def softmax(x):
"""Compute softmax values for each sets of scores in x."""
return np.array([np.exp(e) / np.sum(np.exp(x), axis=0) for e in x])
import matplotlib.pyplot as plt
x = np.arange(-2.0, 6.0, 0.1)
scores = np.vstack([x, np.ones_like(x), 0.2 * np.ones_like(x)])
@diegomrodz
diegomrodz / Secure Internet Voting.md
Created January 30, 2017 11:37 — forked from dsernst/Secure Internet Voting.md
Draft proposal for secure internet voting

Secure Internet Voting

Goals:

  • Allow individuals to vote using their own digital devices.
  • Allow any voter to independently confirm that their vote was entered correctly.
  • Allow any third party to independently tabulate the results of the election.
  • Don't reveal the position taken by any single voter to anyone else.

Requirements:

@diegomrodz
diegomrodz / clip_spritesheet.go
Last active June 11, 2019 12:56
SDL Samples in Go SDL
package main
import (
"github.com/banthar/Go-SDL/sdl"
)
const (
SCREEN_WIDTH int = 640
SCREEN_HEIGHT int = 480
SCREEN_BPP int = 32
@diegomrodz
diegomrodz / pipelines.go
Created September 25, 2014 01:11
Padrões de Concorrencia em Go
package main
import (
"fmt"
"sync"
)
func gen(done <-chan struct{}, nums ...int) <-chan int {
out := make(chan int, len(nums))
go func () {
@diegomrodz
diegomrodz / abstract_method.py
Last active August 29, 2015 14:06
Padrões de projeto implementados em Python.
def overrides(interface_class):
def overrider(method):
assert(method.__name__ in dir(interface_class))
return method
return overrider
class Janela(object):
def set_title(self, title):
raise NotImplementedError()