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 re | |
import unittest | |
pattern = re.compile(r'^(\+?(00)?\s?\d{2,3}[-\.\s]?)?((\d{2,3})[-\.\s]?){3,}$') | |
class ReTest(unittest.TestCase): | |
NOMNOM = ('728 889 137', |
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 -*- | |
from pyquery import PyQuery as pq | |
class JusticePy(object): | |
URL = 'http://www.justice.cz/xqw/xervlet/insl/index?sysinf.%%40typ=or&sysinf.%%40strana=searchResults&hledani.%%40typ=subjekt&hledani.podminka.subjekt=%(subject)s&hledani.podminka.ico=%(ic)s&hledani.podminka.obec=&hledani.podminka.spisZnacka.oddil=&hledani.podminka.spisZnacka.vlozka=&hledani.podminka.spisZnacka.soud=0&hledani.format.pocet_polozek=50&hledani.format.trideni=netridit&hledani.format.typHledani=x*&hledani.format.obchodniJmeno=platne&hledani.podminka.pravniForma=-1&hledani.podminka.ulice=' | |
ALLOWED = ('subject', 'ic') | |
def search(self, **kwargs): |
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
starenka@kosmik1:~$ ipython | |
Python 2.7.2+ (default, Aug 16 2011, 09:23:59) | |
Type "copyright", "credits" or "license" for more information. | |
IPython 0.10.2 -- An enhanced Interactive Python. | |
? -> Introduction and overview of IPython's features. | |
%quickref -> Quick reference. | |
help -> Python's own help system. | |
object? -> Details about 'object'. ?object also works, ?? prints more. |
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
NON='\033[00m' | |
BLD='\033[01m' | |
BNK='\e[5m' | |
NBK='\e[m' | |
RED='\033[01;31m' | |
GRN='\033[01;32m' | |
YEL='\033[01;33m' | |
declare -A states | |
states['Charging']="+" |
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 bash | |
PROJECTS_DIR="/www/outcomm/" | |
REPOS="ssh://[email protected]//home/chrootuser/repos/" | |
VENVWRAPPER_SCRIPT="$(which virtualenvwrapper.sh)" | |
if [ -z "$1" ]; then echo "I need a repo name to setup the project, smeghead! (you can also specify alias as a second arg)"; exit 1; fi | |
if [ -z "$2" ]; then AS="$1"; else AS="$2"; fi | |
. $VENVWRAPPER_SCRIPT | |
TAR=$PROJECTS_DIR$AS |
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 re | |
import mechanize | |
from pyquery import PyQuery as pq | |
START = 1530680 | |
PAGES = 1e3 |
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 logging | |
from rpclib.application import Application | |
from rpclib.decorator import srpc | |
from rpclib.service import ServiceBase | |
from rpclib.model.primitive import String | |
from rpclib.model.primitive import Integer | |
from rpclib.model.complex import Iterable | |
from rpclib.interface.wsdl import Wsdl11 | |
from rpclib.protocol.soap import Soap11 |
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 simplejson as json | |
import lxml | |
class objectJSONEncoder(json.JSONEncoder): | |
"""A specialized JSON encoder that can handle simple lxml objectify types | |
>>> from lxml import objectify | |
>>> obj = objectify.fromstring("<Book><price>1.50</price><author>W. Shakespeare</author></Book>") | |
>>> objectJSONEncoder().encode(obj) | |
'{"price": 1.5, "author": "W. Shakespeare"}' | |
""" |
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 codecs, sys | |
from optparse import OptionParser | |
usage = "\n\t$FILE [-i]" | |
parser = OptionParser(usage) | |
parser.add_option('-i','--input',action='store',dest='input',default = False, help='input file') | |
(options,args) = parser.parse_args() |
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
for i in {1..5000}; do rand=`python -c 'from random import choice;import string;print "".join([choice(string.letters+string.digits) for i in range(20)])'`; curl -X POST -d "{\"email\":\"[email protected]\"}" --header 'Content-Type: application/json; charset=utf-8' --header 'X-Requested-With: XMLHttpRequest' http://www.alza.cz/Services/EShopService.svc/SendActionEmail; done |