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 | |
import time | |
from pyquery import PyQuery as pq | |
while True: | |
def to_float(text): | |
return float(text.text.replace(',', '.')) | |
doc = pq(url='http://www.volby.cz/pls/prez2013/pe2?xjazyk=CZ') | |
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 | |
import time | |
from pyquery import PyQuery as pq | |
def do(): | |
doc = pq('http://www.volby.cz/pls/prez2013/pe2?xjazyk=CZ') | |
perc = map(lambda x: float(x.text.replace(',','.')), doc.find('table.left2 td.cislo[headers="s2a6 s2b5"]')) | |
names = map(lambda x: x.text, doc.find('table.left2 td[headers="s2a1 s2b2"]')) | |
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 | |
import string, re | |
import requests | |
URL_LIST = 'http://www.bestoldgames.net/abc/%s.php' | |
URL_DL = 'http://www.bestoldgames.net/download/bgames/%s.zip' | |
RE_HREF = re.compile(r'<a href="/stare-hry/(.*?).php">') | |
urls = [] |
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 /tmp % wget -S https://developers.csas.cz/html/devs [97% AC] | |
--2015-10-14 20:44:47-- https://developers.csas.cz/html/devs | |
Resolving developers.csas.cz (developers.csas.cz)... 194.50.240.202, 194.50.240.74 | |
Connecting to developers.csas.cz (developers.csas.cz)|194.50.240.202|:443... connected. | |
HTTP request sent, awaiting response... | |
HTTP/1.1 301 Moved Permanently | |
Date: Wed, 14 Oct 2015 18:44:48 GMT | |
Server: Apache | |
Strict-Transport-Security: max-age=31536000 | |
Location: http://127.0.0.1/static_internet/cs/Redakce/Prezentace/Automaticky_rozbalit/Prilohy/devs/ |
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:~$ rhino -e 'print(1+.99)' | |
1.99 | |
starenka@kosmik1:~$ rhino -e 'print(7+.99)' | |
7.99 | |
starenka@kosmik1:~$ rhino -e 'print(7+5.99)' | |
12.99 | |
starenka@kosmik1:~$ rhino -e 'print(7+15.99)' | |
22.990000000000002 | |
starenka@kosmik1:~$ rhino -e 'print(7+25.99)' | |
32.989999999999995 |
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 urllib | |
import requests | |
API_URL = 'http://is.gd/api.php?longurl=' | |
def shorten(uri): | |
resp = requests.get(API_URL + urllib.quote(uri), timeout=30) | |
if resp: | |
return resp.text |
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
def NewTorIP(): | |
s = socket.socket() | |
s.connect(('localhost', 9051)) | |
s.send("AUTHENTICATE\r\n") | |
r = s.recv(1024) | |
if r.startswith('250'): | |
s.send("signal NEWNYM\r\n") | |
r = s.recv(1024) | |
if r.startswith('250'): | |
return True |
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 itertools import izip_longest | |
def intseparator(value, separator=" ", group_every=3): | |
if '.' in value or ',' in value: | |
return value | |
def grouper(n, iterable, padvalue=None): | |
return izip_longest(*[iter(iterable)] * n, fillvalue=padvalue) |
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
.py[co] | |
.idea |