Skip to content

Instantly share code, notes, and snippets.

View kdungs's full-sized avatar
🇦🇶
Nett hier. Aber waren Sie schon mal in Baden-Württemberg?

Kevin Dungs kdungs

🇦🇶
Nett hier. Aber waren Sie schon mal in Baden-Württemberg?
View GitHub Profile
@kdungs
kdungs / Makefile
Created May 4, 2015 23:18
Code for blog post.
CXX=clang++
CXXFLAGS=-O3 -Werror -Weverything -pedantic -Wno-c++98-compat -std=c++14
all: test_mult
clean:
rm -f test_mult
package main
import (
zmq "github.com/pebbe/zmq4"
//"golang.org/x/net/websocket"
"errors"
"fmt"
"strconv"
"strings"
#include <iostream>
#include <boost/serialization/strong_typedef.hpp>
BOOST_STRONG_TYPEDEF(double, Time)
BOOST_STRONG_TYPEDEF(double, Distance)
BOOST_STRONG_TYPEDEF(double, Velocity)
Velocity calculateVelocity(Distance d, Time t) {
return Velocity{static_cast<double>(d) / static_cast<double>(t)};
}
@kdungs
kdungs / check.py
Last active February 21, 2016 12:42
Define a Check monad and corresponding functions in Python. Now also a repo: https://github.com/kdungs/python-mcheck
""" Define a Check monad and corresponding functions.
"""
from functools import partial
class Check:
""" This super class is not really necessary but helps make the structure
clear.
data Check a = Pass a | Fail Message
@kdungs
kdungs / expr.h
Last active May 15, 2016 17:23
A minimalistic solution for the Expression Problem as presented by Eli Bendersky in [his blog](http://eli.thegreenplace.net/2016/the-expression-problem-and-its-solutions/).
#pragma once
#include <string>
#include <utility>
struct Constant {
double value;
};
double eval(const Constant& c) { return c.value; }
@kdungs
kdungs / .vimrc
Last active July 31, 2019 08:09
<50 line minimal Vim configuration.
" .vimrc
"
" Kevin Dungs <[email protected]>
" 2016-07-16
filetype plugin on
set enc=utf-8
" Defaults
@kdungs
kdungs / dither.py
Created December 28, 2023 21:55
Bayer dithering in Python. Useful for Playdate development...
#!/usr/bin/env python3
import argparse
import pathlib
import numpy as np
from PIL import Image
bayer2x2 = 1/4 * np.array([
[0, 2],