Skip to content

Instantly share code, notes, and snippets.

View chiller's full-sized avatar

Endre Galaczi chiller

View GitHub Profile
@chiller
chiller / PropSpec.scala
Created July 3, 2019 07:53
Prettifying
package graphPermissions
import java.util.UUID
import org.scalatest.prop.Checkers.check
import org.scalatest.prop.{Generator, PropertyChecks}
import org.scalatest.{FunSpec, Matchers}
import org.scalacheck.{Shrink, Prop => ScalaCheckProp}
import org.scalacheck.ScalacheckShapeless._
import org.scalacheck.util.Pretty
@chiller
chiller / Commands.scala
Last active October 3, 2018 08:03
CQRS
sealed trait Command
case class CreatePotato(sort: String) extends Command
case class CookPotato() extends Command
case class EatPotato() extends Command
object Command {
import cats.data.State
@chiller
chiller / recipe.md
Last active February 13, 2021 16:52
Bread

Choice of flour and other parameters

The easiest way to get a well rising bread is to use high-protein flour >=12g / 100g https://www.instagram.com/p/BiJhdU_gHkd

Kitchen temperature for reference is 23, but a hot kitchen will significantly speed up the process.

Sponge -- hour 0 (+ however much it took to get active starter)

@chiller
chiller / Readme.md
Last active June 11, 2023 11:04
ab benchmark file upload
@chiller
chiller / README.md
Last active October 1, 2018 13:17
Typeclass Scala

Ad-hoc polymorphism with the typeclass pattern

from Wikipedia: "Ad hoc polymorphism is a dispatch mechanism: control moving through one named function is dispatched to various other functions without having to specify the exact function being called. Overloading allows multiple functions taking different types to be defined with the same name; the compiler or interpreter automatically ensures that the right function is called. This way, functions appending lists of integers, lists of strings, lists of real numbers, and so on could be written, and all be called append—and the right append function would be called based on the type of lists being appended. This differs from parametric polymorphism, in which the function would need to be written

@chiller
chiller / README.md
Last active May 22, 2018 14:55
Sierpinski Triangle

How to run:

ghc fractal.hs
./fractal

TODO:

  • x y to row col
@chiller
chiller / fibo.hs
Created March 27, 2018 12:02
Haskell Memoized Fibonacci
fibo 0 = 1
fibo 1 = 1
fibo k = memo_fibo (k - 1) + memo_fibo (k - 2)
memo_fibo :: Int -> Int
memo_fibo = ((map fibo [0..]) !! )
-- memo_fibo k = ((map fibo [0..]) !! k)
-- this doesn't get memoized
-- https://stackoverflow.com/questions/11466284/how-is-this-fibonacci-function-memoized
@chiller
chiller / noise_on_audio.py
Last active April 28, 2022 18:48
Proof of concept recording audio from a microphone in Python for a table tennis availability project
from sys import byteorder
from array import array
from struct import pack
import pyaudio
import wave
THRESHOLD = 5000
CHUNK_SIZE = 4096
FORMAT = pyaudio.paInt16
@chiller
chiller / Tree.scala
Last active January 22, 2018 12:51
Mutable Tree
package tree.Tree
class Tree(rootValue: Int) {
class Node(var parent: Option[Node], var children: Set[Node], var data: Int) {
}
var root : Node = new Node(None, Set(), rootValue)
def addLeaf(parent: Node, data: Int): Node = {
@chiller
chiller / tag.sh
Last active August 3, 2018 07:15
best build tagging ever
git describe --tags
#example: v0.0-237-g114b509
# last tag - commits since last tag - g for github - hash of commit