Skip to content

Instantly share code, notes, and snippets.

View dszakallas's full-sized avatar
💭
correct is simple

Dávid Szakállas dszakallas

💭
correct is simple
View GitHub Profile
@dszakallas
dszakallas / a
Created November 10, 2023 08:37
a
@dszakallas
dszakallas / keybase.md
Created June 25, 2022 09:34
keybase.md

Keybase proof

I hereby claim:

  • I am dszakallas on github.
  • I am david_szakallas (https://keybase.io/david_szakallas) on keybase.
  • I have a public key whose fingerprint is 38F9 8FCE 7CED FA3C 04D9 B6FE 9E63 257F 2A73 97BB

To claim this, I am signing this object:

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dszakallas
dszakallas / my_first_clojure_go_routine.clj
Created October 29, 2017 12:09
clojure.async examples
(ns my-first-clojure-go-routine
(:require [clojure.core.async :refer :all]))
(defn ping [name chan & [start?]]
(go (when start? (>! chan 0))
(loop [i (<! chan)]
(println name i)
(>! chan (inc i))
(if (< i 100) (recur (<! chan)) i))))
@dszakallas
dszakallas / fixedCapQueue.scala
Created August 25, 2017 09:57
FixedCapacityQueue
import scala.reflect.ClassTag
class FixedCapQueue[A: ClassTag](size: Int) {
val queue: Array[A] = new Array(size)
var start: Int = 0
var end: Int = 0
var empty = size > 0
def take(): A = {
if (end == start && empty) throw new Exception("Queue empty")
@dszakallas
dszakallas / universal.cpp
Created July 12, 2017 20:19
universal reference
template<typename T> void f(T&& param); // param is now a universal reference
int x = 27;
const int cx = x;
const int& rx = x;
f(x); // x is lvalue, so T is int&,
// param's type is also int&
f(cx); // cx is lvalue, so T is const int&,
// param's type is also const int&
f(rx); // rx is lvalue, so T is const int&,
// param's type is also const int&
@dszakallas
dszakallas / BidirectionalMultiMap.scala
Last active June 30, 2017 09:44
BidirectionalMultiMap.scala
/*
Immutable bidirectional multimap with unique set of values and keys.
*/
case class BiMultiMap[K, V](
forward: Map[K, Set[V]] = Map.empty,
backward: Map[V, Set[K]] = Map.empty
) {
import BiMultiMap._
def +(kv: (K, Set[V])): BiMultiMap[K, V] = {
val (nextForward, nextBackward) = kv match {
@dszakallas
dszakallas / kleene.md
Last active February 10, 2018 14:39
Kleene blogpost

Recently I've been writing a graph query engine at Fault Tolerant System Research Group at uni. The frontend is Cypher, a language popularized by Neo Technology shipped OOTB with their graph database Neo4j.

Recently Cypher is getting standardized in an open source and open government initiative under the name openCypher; and other DB vendors, such as the RDBMS giant Oracle are starting to support it.

The language itself is similar to SQL augmented with syntax for graph pattern matching. One of the similarities is the handling of NULL values.

@dszakallas
dszakallas / KleeneWithTypeClasses.scala
Last active June 20, 2017 11:28
Kleene logic in Scala
/* Copyright 2017 David Szakallas, MIT License */
import simulacrum.{op, typeclass}
@typeclass trait GenKleeneLike[-A] {
@op("|=|") def eq(x: A, y: A): Option[Boolean]
@op("|!|") def ne(x: A, y: A): Option[Boolean]
}
object GenKleeneLike {
class GenKleeneLikeForOption[Opt <: Option[Any]] extends GenKleeneLike[Opt] {
override def eq(x: Opt, y: Opt): Option[Boolean] =
@dszakallas
dszakallas / readme.md
Last active September 6, 2017 07:55
Modern JavaScripting a MIDI controller

Modern JavaScripting a MIDI controller

Abstract: Blogpost summarizing the challenges of creating a flexible and customizable MIDI controller mapping for Mixxx targeting multiple Novation Launchpad grid controllers.

Keywords: JavaScript, MIDI, Mixxx, ES6 modules, Babel, Flow

I own two Novation Launchpads. The most iconic use-cases of this cool grid controller is launching samples. Launchpad cover videos are very popular on YouTube. These are done by slicing up the songs, and playing back live, spiced with some flashy visual effects.

You can also use launchpads for DJing. While being fit for a handful of things: cueing samples, beatjumping and looping, etc.; the Launchpad have neither a jogwheel nor any rotary controls or faders, so it falls short on functions like scratching or crossfading. Thus, it’s best to use as companion to your other DJ gear.