I hereby claim:
- I am cypreess on github.
- I am cypreess (https://keybase.io/cypreess) on keybase.
- I have a public key whose fingerprint is CF75 0598 9BFD 5FFC 2541 902E 07FD 403C C58D 9C5D
To claim this, I am signing this object:
export HISTTIMEFORMAT='%F %T ' | |
export CLICOLOR="YES" | |
export LSCOLORS="Fxgxcxdxcxegedabagacad" | |
alias l="ls -lFoh" | |
alias la="ls -lFohA" | |
alias xclip='xclip -selection c' | |
alias grep="grep --color" | |
alias su="su -" |
# The task: cut column 1 and 2 and reorder them 2,1 | |
# TLDR: python 15s awk 1m24s on 1.2 GB text file | |
# WAT? | |
# Dataset: | |
iMac27~/dev/awk_vs_python ls -alh test_data.2 | |
-rw-r--r-- 1 cypreess staff 1.2G Jun 30 17:33 test_data.2 |
vagrant@precise64:/vagrant/monitor$ python monitor.py eth1 --log BLEH -i 100 -vv | |
2014-05-09 19:17:29,850 - INFO - FAMTAR Monitor starting for interfaces: eth1 | |
2014-05-09 19:17:29,850 - INFO - BW min: 0.60 BW max: 0.90 | |
2014-05-09 19:17:29,850 - DEBUG - [eth1] getting address | |
2014-05-09 19:17:29,854 - INFO - [eth1] has address: sh: 1: /usr/local/xorp/sbin/xorpsh: not found | |
2014-05-09 19:17:29,854 - DEBUG - [eth1] getting starting cost | |
2014-05-09 19:17:29,858 - INFO - [eth1] has starting cost: sh: 1: /usr/local/xorp/sbin/xorpsh: not found | |
2014-05-09 19:17:29,859 - DEBUG - [eth1] speed = 1000, BW_MIN = 600000000 bit/s, BW_MAX = 900000000 bit/s | |
2014-05-09 19:17:29,859 - DEBUG - [eth1] counter = 468 B | |
2014-05-09 19:17:29,860 - DEBUG - Waiting 100 miliseconds |
I hereby claim:
To claim this, I am signing this object:
During handling of the above exception, another exception occurred: | |
Traceback (most recent call last): | |
File "/Users/cypreess/dev/django/tests/forms_tests/tests/test_fields.py", line 92, in test_charfield_1 | |
self.assertRaisesMessage(ValidationError, "'This field is required.'", f.clean, None) | |
File "/Users/cypreess/dev/django/django/test/testcases.py", line 576, in assertRaisesMessage | |
re.escape(expected_message), callable_obj, *args, **kwargs) | |
File "/Users/cypreess/dev/django/django/utils/six.py", line 654, in assertRaisesRegex | |
return getattr(self, _assertRaisesRegex)(*args, **kwargs) |
import logging | |
import threading | |
class PeriodicThread(object): | |
""" | |
Python periodic Thread using Timer with instant cancellation | |
""" | |
def __init__(self, callback=None, period=1, name=None, *args, **kwargs): |
# coding=utf-8 | |
from pydic import PyDic | |
sjp = PyDic('../../data/sjp/sjp.pydic') | |
weights = {u'a': 1, u'ą': 5, u'b': 3, u'c': 2, u'ć': 6, u'd': 2, u'e': 1, u'ę': 5, u'f': 5, u'g': 3, u'h': 3, u'i': 1, | |
u'j': 3, u'k': 2, u'l': 2, u'ł': 3, u'm': 2, u'n': 1, u'ń': 7, u'o': 1, u'ó': 5, u'p': 2, u'r': 1, u's': 1, | |
u'ś': 5, u't': 2, u'u': 3, u'w': 1, u'y': 2, u'z': 1, u'ź': 9, u'ż': 5, } | |
def rank(word): |
Using worker: worker-linux-3-2.bb.travis-ci.org:travis-linux-9 | |
$ git clone --depth=50 --branch=master git://github.com/agh-glk/pydic.git agh-glk/pydic | |
Cloning into 'agh-glk/pydic'... | |
remote: Counting objects: 155, done. | |
remote: Compressing objects: 100% (87/87), done. | |
remote: Total 155 (delta 71), reused 144 (delta 66) | |
Receiving objects: 100% (155/155), 43.05 KiB | 0 bytes/s, done. | |
Resolving deltas: 100% (71/71), done. | |
$ cd agh-glk/pydic |
>>> from itertools import * | |
# First try is like that - OK it works | |
>>> count = 5 | |
>>> iterator = xrange(100) | |
>>> list(imap(None, *([iter(iterator)] * count))) | |
[(0, 1, 2, 3, 4), (5, 6, 7, 8, 9), (10, 11, 12, 13, 14), (15, 16, 17, 18, 19), (20, 21, 22, 23, 24), (25, 26, 27, 28, 29), (30, 31, 32, 33, 34), (35, 36, 37, 38, 39), (40, 41, 42, 43, 44), (45, 46, 47, 48, 49), (50, 51, 52, 53, 54), (55, 56, 57, 58, 59), (60, 61, 62, 63, 64), (65, 66, 67, 68, 69), (70, 71, 72, 73, 74), (75, 76, 77, 78, 79), (80, 81, 82, 83, 84), (85, 86, 87, 88, 89), (90, 91, 92, 93, 94), (95, 96, 97, 98, 99)] | |
# Apparently imap(None,...) is equivalent to izip() - so we can simplify it | |
>>> count = 5 |
class ExtraValueMixin(object): | |
value = 1 | |
def get_value(self): | |
return self.value | |
def get_context_data(self, *args, **kwargs): | |
context = .... super ... get_context_data | |
context['extra_value'] = self.get_value() | |
return context | |