Skip to content

Instantly share code, notes, and snippets.

View martin-ueding's full-sized avatar

Martin Ueding martin-ueding

View GitHub Profile
@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
"""
#!/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 / 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:
@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
// 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)};
#!/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()
mu@fedora-22-beta:~ SSH 17.8s su 2015-05-25 17:06:46
Passwort:
[root@fedora-22-beta mu]# dnf install rubygem-rails
Last metadata expiration check performed 0:00:00 ago on Mon May 25 17:07:37 2015.
Abhängigkeiten sind aufgelöst.
===============================================================================================================================================================================================================================================
Paket Arch Version Paketquelle Größe
=================================================================================================================================
@martin-ueding
martin-ueding / gist:a2b79b500c91e590de5e
Last active August 29, 2015 14:22
File descriptor leak test
// Copyright © 2015 Martin Ueding <dev@martin-ueding.de>
// Try to leak as many file descriptors until the program crashes.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
char filename[100];
@martin-ueding
martin-ueding / texlive-doc.py
Last active November 6, 2015 21:28
Install TeXLive documentation on Fedora 22
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright © 2015 Martin Ueding <dev@martin-ueding.de>
# Licensed under The MIT License
'''
Installs documentation packages for all installed TeXLive packages on Fedora
22.
#!/bin/bash
# Copyright © 2016 Martin Ueding <dev@martin-ueding.de>
set -e
set -u
set -x
width=2480
half_height=$(( 3508 / 2 ))