Skip to content

Instantly share code, notes, and snippets.

@danoneata
danoneata / color_correction.py
Created September 30, 2022 09:42
Colour correction using a color checker
# This example based on the following tutorial
# https://github.com/colour-science/colour-checker-detection/blob/master/colour_checker_detection/examples/examples_detection.ipynb
import matplotlib.pyplot as plt
import numpy as np
import streamlit as st
import colour
from colour_checker_detection import detect_colour_checkers_segmentation
@danoneata
danoneata / example.py
Created June 7, 2022 14:07
JSON decoder in Python
from main import *
@dataclass
class Measurment:
temp: float
humidity: float
# date: datetime
@danoneata
danoneata / .tmux.conf
Created December 15, 2020 10:39
dotfiles
# Remap prefix to C-q.
set -g prefix C-q
unbind C-b
bind C-q send-prefix
# Use C-q C-q to go back to the last window.
bind-key C-q last-window
# Faster command sequences.
set -s escape-time 0
@danoneata
danoneata / README.md
Created June 21, 2019 12:23
Unix shell intro

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 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
@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 / 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 / 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 / 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 / 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