This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c7h in ~/workspace/TimetableParser/examples on master ● λ python read_semesterplan.py -u if1184 | |
Password: | |
Deine Faecher dieses Semester: | |
00: Entwicklung mobiler Anwendung unter iOS bei Mack, Alexander | |
01: Next Generation Networks bei Sós, Eckhard | |
Heute auf dem Plan: | |
---nichts--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\usetikzlibrary{arrows} | |
\begin{document} | |
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=5cm, | |
thick,main node/.style={circle,fill=blue!20,draw, | |
font=\sffamily\Large\bfseries,minimum size=15mm}] | |
\node[main node] (B) {B}; %Bereit | |
\node[main node] [above left of=B](L) {L}; %Laufend | |
\node[main node] [above right of=B](I) {I}; %Inaktiv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'Christoph Gerneth' | |
class SingletonType(type): | |
def __call__(self, *args, **kwargs): | |
try: | |
return self.__instance | |
except AttributeError: | |
self.__instance = super(SingletonType, self).__call__(*args, **kwargs) | |
return self.__instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'Christoph Gerneth' | |
''' | |
Decorators are one of the most powerful patterns. They can be used to | |
inject code in functions, modify them and infuence their beihavior. | |
[wikipedia](https://en.wikipedia.org/wiki/Decorator_pattern) | |
Here is an example: | |
''' | |
class Tools(object): | |
@classmethod | |
def sayhello(self, func): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'Christoph Gerneth' | |
from csv import DictWriter | |
from random import randrange | |
filename = 'data.csv' | |
label = ['x-axis', 'y-axis'] | |
with open(filename, 'w') as f: | |
csvw = DictWriter(f, fieldnames=label) | |
csvw.writeheader() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BinSearchTreeElement(object): | |
def __init__(self, data, leftTree=None, rightTree=None): | |
self.data = data | |
self.left = leftTree | |
self.right = rightTree | |
def add(self, element): | |
if element <= self.data: | |
self._insertElement(self.left, element) | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
my $user_c = 0; | |
my $user_min = 0; | |
my @ip = (); | |
while(<>) { | |
if (m/(^\w+).*(\d{2}:\d{2})/) { | |
if ($1 eq 'christoph'){ | |
$user_c++; # user_zaehler erhöhen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import inspect | |
start_time = time.time() | |
debuglevel = 2 #e.g: 0=no 1=error 2=info ... | |
def printdebug(level, message): | |
if debuglevel >= level: | |
curr_time = time.time() - start_time | |
caller = inspect.stack()[1][3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Created on Feb 6, 2013 | |
@author: Christoph Gerneth | |
''' | |
import time | |
import inspect | |
class SingletonType(type): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = 8 #format | |
[line[i:i+n] for i in range(0, len(line), n)] |
OlderNewer