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
@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
#!/usr/bin/env python
# coding: utf-8
import sys
import argparse
from contextlib import closing
import io
--
-- Variante 1:
--
CREATE TABLE if not exists Autos (
CarID INTEGER PRIMARY KEY,
Marke TEXT
)
CREATE TABLE if not exists Fahrer (
Name TEXT PRIMARY KEY,
@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
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
#!/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/
python group.py data.txt
1
1
2
3
3
3
#!/usr/bin/env python
# coding: utf-8
import xml.etree.ElementTree as etree
from pprint import pprint
data = """
<data>
<parts>
<part name="komplexes Teil">
@Lysander
Lysander / Dog.java
Last active December 22, 2015 09:39
package parrots;
public class Dog {
private String name;
public Dog(String name) {
this.name = name;
}
#!/usr/bin/env python3
from random import randint
from collections import Counter
COIN = {
1: "Kopf",
2: "Zahl"
}