Skip to content

Instantly share code, notes, and snippets.

View honzajavorek's full-sized avatar
🐣
improving junior.guru

Honza Javorek honzajavorek

🐣
improving junior.guru
View GitHub Profile
@msgre
msgre / texytypo.py
Created September 30, 2012 04:47
Texy typoška
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
@starenka
starenka / flipy.py
Created February 18, 2012 21:54
Simple flickr uploader - uploads several files at once
#!/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
@insin
insin / bash_prompt.sh
Created December 3, 2011 01:49 — forked from woods/git_svn_bash_prompt.sh
Set color bash prompt according to active virtualenv, git branch and return status of last command.
#!/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.
@starenka
starenka / papu.py
Created August 5, 2011 23:45
greps menus of my fav restaurants close to my office
#!/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())
@telendt
telendt / gist:607454
Created October 2, 2010 08:28
html_entity_decode in Python
#!/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()))