Skip to content

Instantly share code, notes, and snippets.

View Lysander's full-sized avatar

Christian Hausknecht Lysander

  • format-h
  • Hamburg, Germany
View GitHub Profile
#!/usr/bin/env python
# coding: utf-8
import xml.etree.ElementTree as etree
from pprint import pprint
data = """
<data>
<parts>
<part name="komplexes Teil">
python group.py data.txt
1
1
2
3
3
3
#!/usr/bin/env python3
# coding: utf-8
"""
~~~~~~~~
DiceGame
~~~~~~~~
Umsetzung des "Würfelspiels 1.0" aus einem Thread bei ubuntuusers.de
http://forum.ubuntuusers.de/post/5643272/
23498239482938492384078789789789 bla/blub/datei1.dat
d41d8cd98f00b204e9800998ecf8427e ga/bla2345.txt
b9dd393b05195aa2288bd1611d7fc361 bluber/bla4325.txt
d41d8cd98f00b204e9800998ecf8427e data/ghghg/mfdfdf.dat
57dd7f249a99923eea234e62895dc03f test.txt
d41d8cd98f00b204e9800998ecf8427e data/anderer_name_als_mfdfdf.dat
@Lysander
Lysander / tax.py
Created December 31, 2012 11:50
Simple proposal for the exercise in this thread: http://www.python-forum.de/viewtopic.php?f=1&t=30699
#!/usr/bin/env python
# was auch immer das sein mag...
CRITICAL_LIMIT = 4000
def calc_tax_value(salary, tax_rate):
return salary * tax_rate / 100
--
-- Variante 1:
--
CREATE TABLE if not exists Autos (
CarID INTEGER PRIMARY KEY,
Marke TEXT
)
CREATE TABLE if not exists Fahrer (
Name TEXT PRIMARY KEY,
#!/usr/bin/env python
# coding: utf-8
import sys
import argparse
from contextlib import closing
import io
@Lysander
Lysander / Output
Created August 1, 2012 17:47
Sort a file by an indexfile which defines the order; http://forum.ubuntuusers.de/topic/logische-zusammenfuegen-von-2-dateien/
./sort.py index.txt < data.txt
MaxMusterPerson3 5 12
Tobi Testperson 7 38
NachnamePerson3 43 23
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 2 in line 1.
ISBN;Verlag;Titel;Stand;Preis;Bestand
978-3768825825;Delius Klasing;MV – Bornholm;2009-01;54,90;2
978-3768832021;Delius Klasing;MV – Bornholm;2011-03;54,90;13
978-3892255598;Edition Maritim;Rund Rügen;2008-03;29,90;15
978-3892252368;Delius Klasing;Küstenhandbuch MV;2006-03;29,90;3
978-3980672016;Quick Maritim Medien;Törnplaner/-atlas Peene, Oder, Bodden;2006-04;25,00;5
978-3768831017;Delius Klasing;Kieler Bucht und Rund Fünen (2010);2010-03;69,90;17
@Lysander
Lysander / smile4pycon.py
Created June 29, 2012 13:18
Little fun script, that prints out an happy or unhappy smiley based upton the "+-/1" messages in the "I am goging to pycon"-Thread: http://www.python-forum.de/viewtopic.php?f=5&t=29566
#!/usr/bin/env python
import re
from collections import defaultdict
import requests
from lxml import html
URL = r"http://www.python-forum.de/viewtopic.php?f=5&t=29566"