Skip to content

Instantly share code, notes, and snippets.

View fmoessbauer's full-sized avatar
🐢
slow and steady wins the race

Felix Moessbauer fmoessbauer

🐢
slow and steady wins the race
  • Siemens AG
  • Beijing
View GitHub Profile
@fmoessbauer
fmoessbauer / TerminableSleep.hpp
Created January 29, 2020 16:06
Terminable Sleep Implementation
#pragma once
/**
* Authors:
* Felix Moessbauer <felix.moessbauer@siemens.com>
*
* SPDX-License-Identifier: MIT
*/
#include <chrono>
#include <condition_variable>
@fmoessbauer
fmoessbauer / replacer.sh
Last active February 13, 2018 08:17
BASH Script to substitute secrets in configuration files
#!/bin/bash
# Trivial solution to replace placeholders in config files
# Finds all .tpl files, replaces keys and stores the result
# without .tpl
#
# Usage: replacer.sh <keyfile>
#
# Keyfile format:
# key=value
# key2=value2
@fmoessbauer
fmoessbauer / boost_graph_to_dimacs.hpp
Created November 24, 2017 13:18
Export a boost graph to dimacs format.
#ifndef BGL_WRITE_DIMACS_INC
#define BGL_WRITE_DIMACS_INC
/**
* export boost graph to dimacs graph format
*/
template<typename graph_t>
void write_dimacs(const graph_t & graph, std::ostream & out){
auto num_edges = boost::num_edges(graph);
auto num_vertices = boost::num_vertices(graph);
@fmoessbauer
fmoessbauer / two-language-booklet.py
Last active August 22, 2017 09:40
This script create a two-language booklet from two pdfs
#!/usr/bin/python
#
# This script create a two-language booklet from two pdfs
# The result is a single pdf where the pages of the second input
# are reversed and turned by 180 deg so that the reader of the booklet
# can start reading with the language he prefers. The other language can be
# read by turning and flipping the booklet around
import sys
import PyPDF2 as pdf
@fmoessbauer
fmoessbauer / solution5-1.ipynb
Last active July 21, 2017 12:26
MMMOG Exercise 5
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fmoessbauer
fmoessbauer / solution8-1-SVM.ipynb
Last active August 6, 2017 15:08
Exercise 8-1 - Optimal Separating Hyperplane
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fmoessbauer
fmoessbauer / EditDistance.cpp
Last active July 15, 2017 10:44
Implementation of the Wagner-Fischer algorithm to calculate the edit distance between two strings. See also https://en.wikipedia.org/wiki/Wagner%E2%80%93Fischer_algorithm
/*
* Notice: Requires C++11 support
*/
#include <vector>
#include <string>
#include <algorithm>
/**
* Implementation of the Wagner-Fischer algorithm
* closely following https://en.wikipedia.org/wiki/Wagner%E2%80%93Fischer_algorithm
@fmoessbauer
fmoessbauer / mnist.py
Last active June 17, 2017 17:59 — forked from akesling/mnist.py
import os
import struct
import numpy as np
"""
Loosely inspired by http://abel.ee.ucla.edu/cvxopt/_downloads/mnist.py
which is GPL licensed.
"""
def read(dataset = "training", path = "."):