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/env python | |
# http://stackoverflow.com/questions/1939902 | |
from __future__ import division | |
import itertools | |
operands = [1, 2, 3, 5, 7] | |
operators = ['+', '-', '*', '/'] |
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/env python | |
# http://stackoverflow.com/questions/2953421/split-based-by-a-z-character-in-an-alphanumeric-string-in-python/2953461#2953461 | |
import re | |
s = "5d4h2s" | |
p = re.compile("([0-9])([a-z])") | |
def mm(s): |
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
<xs:element name="gap"> | |
<xs:complexType> | |
<xs:sequence> | |
<xs:element name="correct" type="xs:string" maxOccurs="unbounded"/> | |
</xs:sequence> | |
<xs:attribute name="inputLength" use="optional"> | |
<xs:simpleType> | |
<xs:restriction base="xs:int"> | |
<xs:minInclusive value="1"/> | |
</xs:restriction> |
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
$ cd ~/projects/ialt | |
$ ls -1 | |
downloads | |
elateXam | |
elateXam-support | |
elateXamSmall.tar.gz | |
$ mkdir elateXamSmall | |
$ cp elateXamSmall.tar.gz elateXamSmall | |
$ cd elateXamSmall | |
$ tar xvzf elateXamSmall.tar.gz |
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/env python | |
# http://stackoverflow.com/questions/3139869/heapq-nlargest-index-of-returned-result-in-original-sequence/3139918#3139918 | |
import heapq | |
from timeit import Timer | |
seq = [100, 2, 400, 500, 400] + range(9995) | |
# seq = ("hello", 2, "world", 500, 400) |
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
# sagt mir wo die php-executable sich befindet ... | |
$ which php | |
php is /usr/bin/php | |
# erstelle mir ein entsprechendes Verzeichnis | |
# -p heißt, auch alle "Zwischenverzeichnisse" erstellen, falls diese nicht existeiren | |
$ mkdir -p /usr/local/psa/admin/bin | |
# erstelle eine symbolischen link auf die php-executable | |
$ ln -s /usr/bin/php /usr/local/psa/admin/bin/php |
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
h1639710:~ $ locate bin/php | |
/opt/psa/admin/bin/php | |
/opt/psa/admin/sbin/php_from_sql_charsets | |
/opt/psa/admin/sbin/phpc | |
/opt/psa/bin/php-cli | |
... | |
# alten "link" entfernen ... | |
h1639710:~ $ sudo rm /usr/local/psa/admin/bin/php |
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
This gist was saved via command-line ... |
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 A(object): | |
active = True | |
def about_me(self): | |
return A.active | |
def am_i_active(self): | |
if self.__class__.active: | |
print 'Yes, sir!' | |
else: | |
print 'Nope.' |
OlderNewer