Skip to content

Instantly share code, notes, and snippets.

View martin-ueding's full-sized avatar

Martin Ueding martin-ueding

View GitHub Profile
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright © 2015 Martin Ueding <dev@martin-ueding.de>
# Licensed under The MIT License
import argparse
def main():
options = _parse_args()
// Copyright © 2014 Martin Ueding <dev@martin-ueding.de>
#include <iostream>
#include <regex>
int main() {
std::string haystack {"This\nhas\nnewlines."};
std::regex regex {"\n"};
std::string replacement {"\n# "};
std::string result {std::regex_replace(haystack, regex, replacement)};
@martin-ueding
martin-ueding / rename-physik511-lecture-notes
Last active January 1, 2016 16:49
Rename lecture notes files for physik511.
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright © 2013-2014 Martin Ueding <dev@martin-ueding.de>
# Licensed under The GNU Public License Version 2 (or later)
import argparse
import re
import shutil
@martin-ueding
martin-ueding / colorcodes.py
Created November 3, 2012 11:04
Python Colorcodes class
class Colorcodes(object):
"""
Provides ANSI terminal color codes which are gathered via the ``tput``
utility. That way, they are portable. If there occurs any error with
``tput``, all codes are initialized as an empty string.
The provides fields are listed below.
Control:
#!/bin/bash
# This script is in the public domain.
# Based on an idea by Fabien Udriot
# see http://pastie.org/4225971
# Enter your username for typo3.org here. If no username is entered here, you
# will be promted for it during execution.
username=""
@martin-ueding
martin-ueding / dog.py
Created January 27, 2012 17:43
running dog with alarm clock
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Martin Ueding <dev@martin-ueding.de>
"""
Based on a Question from "Physics - Stack Exchange".
http://physics.stackexchange.com/questions/20083/riddle-about-speed
"""