Skip to content

Instantly share code, notes, and snippets.

@behrtam
behrtam / htwaib_finalgrade.py
Created August 3, 2015 13:57
HTW AI Bachelor – Berechnung des Gesamtprädikats
#!/usr/bin/env python
# coding: utf8
from __future__ import print_function
'''
HTW AI Bachelor
§9 Berechnung des Gesamtprädikats
http://ai-bachelor.htw-berlin.de/fileadmin/HTW/Alle/Amtliche_Mitteilungsblaetter/2012/30_12.pdf
'''
import sys
with open(sys.argv[1]) as source, open('ln_' + sys.argv[1], 'w') as target:
for i, line in enumerate(source):
target.write('{:02d}{}'.format(i,line[2:]))
@behrtam
behrtam / SConstruct
Created November 3, 2013 10:46
Instead of writing down the needed cpp-files manually, it just takes all the cpp-files of the current directory.
"""
This Auto-SConstruct takes alle *.cpp files of the current directory - the directory the SContruct is placed in.
The program name is based on the name of a file ending with '_main.cpp'.
Example: 'myprog_main.cpp' -> 'myprog'
If there is a file eding with '_test.cpp' a google testprogram is compiled with a similar naming process.
Example: 'mytest_main.cpp' -> 'mytest'
author: Tammo Behrends (2013)
@behrtam
behrtam / caesar.c
Last active December 14, 2015 16:29 — forked from haup/caesar.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef char* string;
string encrypt(int offset, string text);
string decrypt(int offset, string text);
/* Programmaufruf: ceasar [-d|-e] [offset] [text ...]