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 re | |
# sada regularnich vyrazu pro lepsi typosku | |
# zdroj: texy-2.1/texy/modules/TexyTypographyModule.php | |
TEXY_CHARS = ur'A-Za-z\u00C0-\u02FF\u0370-\u1EFF' | |
TEXY_TYPO_PATTERNS = [ | |
(re.compile(ur'(?<![.\u2026])\.{3,4}(?![.\u2026])', re.M | re.U), u"\u2026"), # ellipsis ... | |
(re.compile(ur'(?<=[\d ])-(?=[\d ]|$)'), u"\u2013"), # en dash 123-123 | |
(re.compile(ur'(?<=[^!*+,/:;<=>@\\\\_|-])--(?=[^!*+,/:;<=>@\\\\_|-])'), u"\u2013"), # en dash alphanum--alphanum |
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 | |
# -*- coding: utf-8 -*- | |
# pip install flickrapi grequests gevent | |
from __future__ import division | |
import logging, os, sys | |
from optparse import OptionParser | |
import xml.etree.ElementTree as ElementTree | |
import flickrapi |
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 | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the active virtualenv | |
# * the branch/status of the current git repository | |
# * the return value of the previous command | |
# * the fact you just came from Windows and are used to having newlines in | |
# your prompts. |
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 | |
# -*- coding: utf-8 -*- | |
import datetime | |
from pyquery import PyQuery as pq | |
doc = pq(url='http://www.jinakrajina.cz/cz/poledni-menu') | |
noms = doc.find('td > p') | |
print '\n%s'%noms[0].text_content()[2:] | |
for i,nom in enumerate(noms[1:-1:2],1): | |
print '[%d] %s'%(i,nom.text_content().strip()) |
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 | |
# -*- coding: utf-8 -*- | |
import htmlentitydefs | |
import re | |
entity_re = re.compile(r'&(%s|#(\d{1,5}|[xX]([\da-fA-F]{1,4})));' % '|'.join( | |
htmlentitydefs.name2codepoint.keys())) |