Created at PyCon PL as a coding dojo challenge
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
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"query_string": { | |
"query": "\"ruby\" OR \"rubi\" OR \"rubz\"", | |
"default_operator": "or" | |
} | |
} | |
], |
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
# -*- coding: cp1250 -*- | |
class Halda(): | |
"""halda - dokumentace | |
TYP 1A na vrcholu nejmenší hodnota, prosté položky | |
TYP 1B na vrcholu nejmenší hodnota, strukturované položky | |
TYP 2A na vrcholu největší hodnota, prosté položky | |
TYP 2B na vrcholu největší hodnota, strukturované položky | |
""" | |
### 0 Konstrukční procedury |
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
''' | |
VERY HACKY, DO NOT USE OR DO NOT COMPLAIN. | |
It was written to deal with forms.fields tests and those tests only. | |
''' | |
f = open('forms.py', 'r') | |
out = open('out.py', 'w') | |
res_words = ['def', 'from', 'try', 'import'] | |
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 PageParserAndThumbnailer(object): | |
def __init__(self, url, http_response): | |
self.url = url | |
self.headers, self.body = self.parse(http_response) | |
@property | |
def thumbnail(self): | |
"create expensive thumbnail" | |
def parse(self, http_response): |
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
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: hookbox | |
# Required-Start: | |
# Required-Stop: | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 1 | |
# Short-Description: hookbox server | |
### END INIT INFO |
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
#!/bin/bash | |
curl -O https://raw.github.com/pypa/virtualenv/master/virtualenv.py | |
python virtualenv.py testing_in_python | |
. testing_in_python/bin/activate | |
pip install django mock | |
python testable_templatetag.py |
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
from elasticsearch_dsl import DocType, Object, MetaField | |
class MyDoc(DocType): | |
inner = Object() | |
class Meta: | |
dynamic_templates = MetaField([ | |
{ | |
'strings_in_inner': { | |
'path_match': 'inner.*', |
I hereby claim:
- I am honzakral on github.
- I am honzakral (https://keybase.io/honzakral) on keybase.
- I have a public key ASC44AI9qQetZNTdBWjaYJitFwRRI-X7g3dMXl6Pp0hQWQo
To claim this, I am signing this object:
Experimental CLI interface for the helpers in the python library.
Main purpose is to expose the bulk functionality to enable rapid loading of data into an elasticsearch cluster. Combined with the scan command it can also be used to reindex data from elasticsearch into a different index or cluster.
OlderNewer