Skip to content

Instantly share code, notes, and snippets.

Avatar

Dan Oneata danoneata

View GitHub Profile
@danoneata
danoneata / README.md
Created Jun 21, 2019
Unix shell intro
View README.md

Intro

  • shell takes commands and passes to the operating system
  • most popular shell is bash (Bourne Again Shell): a replacement of sh, the origianl Unix shell, which was written by Steve Bourne
  • motivating examples:
# Copies all HTML files to `destination`,
# but only those that do not exist or are newer
cp -u *.html destination
@danoneata
danoneata / talk.md
Created May 10, 2019
Resources on how to give a talk
View talk.md
  • 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
@danoneata
danoneata / maml.py
Last active Mar 15, 2019
Model-agnostic meta learning
View maml.py
"""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 / gauss2d.py
Last active May 5, 2020
Plot a 2D Gaussian
View gauss2d.py
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 / IOAction.hs
Last active Oct 19, 2018
Toying with free monads
View IOAction.hs
{-# 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 / monoids.md
Last active Jul 31, 2018
Monoids – Bucharest FP #31
View monoids.md

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 / main.py
Created Apr 21, 2018
Time series classification for gesture recognition
View main.py
import argparse
import pdb
import os
import sys
from collections import namedtuple
import numpy as np
import pandas as pd
@danoneata
danoneata / hodgp.py
Last active Apr 2, 2018
Python implemetation of Origami patterns
View hodgp.py
from functools import singledispatch
class Document:
pass
class Paragraph(Document):
def __init__(self, text):
self.text = text
@danoneata
danoneata / Sudoku.hs
Last active Sep 11, 2019
Applicative-based Sudoku solver
View Sudoku.hs
{-# 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)
You can’t perform that action at this time.