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
#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 / skiplist.cpp
Created May 14, 2012 20:25
I just found this among my backups. I implemented this in year 2008 as a high school student attending a lecture at university. It's an English-German-dictionary implemented through a skiplist. I don't know if this works, but it might have back then...
#include "Skiplist.h"
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char ** argv)
{
Dictionary dict;
static char QUIT = 'q';
@kdungs
kdungs / dl_numerical_analysis.sh
Created July 11, 2012 14:03
Quickly download all assignments and solutions for Numerical analysis in Heidelberg (2011) and Dortmund (2012).
#!/usr/bin/env zsh
for i in {01..14}
do
wget http://numerik.uni-hd.de/\~lehre/SS11/numerik/Docs/Loesungen/loesung_$i.pdf
wget http://numerik.uni-hd.de/\~lehre/SS11/numerik/Docs/Uebungen/uebung_$i.pdf
wget http://www.mathematik.tu-dortmund.de/lsx/cms/media/numphy2012/Blatt$i.pdf
wget http://www.mathematik.tu-dortmund.de/lsx/cms/media/numphy2012/Loesung$i.pdf
done
@kdungs
kdungs / bundesliga_emblems.py
Created August 1, 2012 22:21
If you ever happen to need the emblems of Bundesliga football teams.
#!/usr/bin/env python
from os import mkdir, path
from PIL import Image
from requests import get
from StringIO import StringIO
BASE = "http://www.bundesliga.de/pics/_2012/wappen"
SIZES = (25, 80)
TEAMS = {
@kdungs
kdungs / settings.py
Created August 18, 2012 19:50
Example settings for tippspiel.
# Django settings for bundesliga project.
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
from os.path import dirname, join
ROOT = dirname(__file__)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
@kdungs
kdungs / pw.py
Created August 18, 2012 19:51
Random password generator.
#!/usr/bin/env python
import string as s
from random import randint
from sys import argv
CHARS = s.ascii_letters + s.digits + s.punctuation
def main(argc, argv):
l = 12
@kdungs
kdungs / bronstein.sh
Created October 30, 2012 20:34
Create local copy of digital Bronstein.
#!/bin/sh
# Only works from within the university's network!
wget --mirror -k -E http://cdroms.digibib.net/bronstein/
@kdungs
kdungs / monty_hall.py
Created November 2, 2012 21:29
A simple simulation of the Monty Hall Problem.
#!/usr/bin/env python
# coding=utf-8
from __future__ import division
import itertools as it
import random as r
from sys import argv
def play_round(switch_choice=True):
@kdungs
kdungs / Makefile
Created November 28, 2012 21:18
Testing GSL
P = test_gsl
OBJECTS = test_gsl.c
CFLAGS = -g -Werror -O3 -std=gnu11 `pkg-config --cflags gsl`
LDLIBS = `pkg-config --libs gsl`
CC = gcc-mp-4.7
$(P): $(OBJECTS)
clean:
rm $(P)
@kdungs
kdungs / robot.js
Created December 19, 2012 13:41
Gauß 2.0
var Robot = function(robot) {
};
var found = false;
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
if (!found) {
robot.rotateCannon(1);
robot.ahead(1);