Skip to content

Instantly share code, notes, and snippets.

@danoneata
danoneata / sudoku.py
Created June 14, 2017 09:20
Skeleton code for Sudoku solver in Python
from typing import (
List,
TypeVar,
)
# Type aliases
A = TypeVar('A')
Digit = int
Matrix = List[List[A]]
Grid = Matrix[Digit]
@danoneata
danoneata / Sudoku.hs
Last active August 20, 2022 01:27
Applicative-based Sudoku solver
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
import Control.Applicative
import Data.Char
import Data.List (intersperse)
import Data.Monoid hiding (All, Any)
import Data.Foldable hiding (all, any)
import Prelude hiding (all, any)
@danoneata
danoneata / deep-learning-ai.md
Last active November 28, 2017 13:28
Deep Learning AI #1
@danoneata
danoneata / hodgp.py
Last active April 2, 2018 10:43
Python implemetation of Origami patterns
from functools import singledispatch
class Document:
pass
class Paragraph(Document):
def __init__(self, text):
self.text = text
@danoneata
danoneata / main.py
Created April 21, 2018 12:33
Time series classification for gesture recognition
import argparse
import pdb
import os
import sys
from collections import namedtuple
import numpy as np
import pandas as pd
@danoneata
danoneata / monoids.md
Last active July 31, 2018 12:51
Monoids – Bucharest FP #31

Definition (monoid). A monoid consists of:

  1. a set M
  2. a binary operation · : M × M → M
  3. an element e ∈ M

such that

  1. the binary operation is associative, that is, x · (y · z) = (x · y) · z, ∀ x, y, z ∈ M
  2. the element e is identity: x · e = x = e · x, ∀ x ∈ M.
@danoneata
danoneata / IOAction.hs
Last active October 19, 2018 20:19
Toying with free monads
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE LambdaCase #-}
-- This script is based on Chris Taylor's gist: https://gist.github.com/chris-taylor/4745921
--
-- The main differences are:
-- 1. An interpretation in a different monad, the RWS monad. This idea was also was taken from somewhere else:
-- http://www.cs.uu.nl/docs/vakken/afp/assignment3.html
-- 2. An implementation based on free monads, see the `IOActionFreeMonad.hs` file.
@danoneata
danoneata / gauss2d.py
Last active May 5, 2020 12:58
Plot a 2D Gaussian
import numpy as np
import pdb
from matplotlib import pyplot as plt
from scipy.stats import multivariate_normal
def gauss2d(mu, sigma, to_plot=False):
w, h = 100, 100
std = [np.sqrt(sigma[0, 0]), np.sqrt(sigma[1, 1])]
@danoneata
danoneata / maml.py
Last active March 15, 2019 10:35
Model-agnostic meta learning
"""This code is inspired by the homework 2 from CSC421/2516 Winter 2019,
but I'm taking a more functional approach.
http://www.cs.toronto.edu/~rgrosse/courses/csc421_2019/homeworks/hw2.pdf
http://www.cs.toronto.edu/~rgrosse/courses/csc421_2019/homeworks/maml.py
"""
import autograd.numpy as np
import autograd as ag
@danoneata
danoneata / talk.md
Created May 10, 2019 16:53
Resources on how to give a talk
  • Kristen Grauman – Tips for Preparing a Clear Talk slides video
  • Patrick Winston – How to Speak videos; see, especially, The Big Four
  • Ranjit Jhala – (An Opinionated Talk) On Preparing Good Talks slides video
  • Gary Bernhardt – How to Prepare a Talk article
  • Iain Murray – Speaking Resources notes