This file contains hidden or 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
| class Document(models.Model) | |
| def get_uuid(self): | |
| def bijective_encode(i, start=0): | |
| #http://stackoverflow.com/a/742047/754305 | |
| i += start | |
| CHARS = list('zpYUgh9XWvHbNVK6kmAufqCSeyiBZ7RcLd4GJ5ETMnwPDrx3s8QaF2jt') #randomized to avoid iteration | |
| s = '' | |
| base = len(CHARS) | |
| while i > 0: | |
| s += CHARS[i % base] |
This file contains hidden or 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 decimal import Decimal | |
| >>> Decimal(10.2+30) | |
| Decimal('40.2000000000000028421709430404007434844970703125') | |
| >>> _ == Decimal(40.2) | |
| True |
This file contains hidden or 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
| cvt 1680 1050 #get xorg-like line for this resolution | |
| xrandr --newmode "flatronw2242s" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync #make the mode | |
| xrandr --addmode VGA1 "flatronw2242s" #add it to xrandr |
This file contains hidden or 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
| #tady je priklad jednoho projektu: | |
| # [-]luft_vagrant | |
| # [+].hg | |
| # .hgignore | |
| # [+].vagrant | |
| # README.md | |
| # Vagrantfile | |
| # [-]provisioning | |
| # ansible_hosts |
This file contains hidden or 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
| class ModuleAdmin(admin.ModelAdmin): | |
| class ParentFilter(SimpleListFilter): | |
| title = _('Parent') | |
| parameter_name = 'parent' | |
| def lookups(self, request, model_admin): | |
| return [(m.id, m.name) for m in Module.objects.filter(parent__isnull=True).order_by('name')] + [('Null', 'Null')] | |
| def queryset(self, request, queryset): | |
| if self.value(): |
This file contains hidden or 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
| ''' | |
| <?php | |
| $array = array_fill(0,10000, "ahoj"); | |
| $count = 0; | |
| $length = 0; | |
| foreach($array as $item) { |
This file contains hidden or 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 % grep '^z.*l$' /data/slovniky/Czech.3-0-8utf8u.dic | |
| zabal | |
| zabalil | |
| zabarikádoval | |
| zabarvil | |
| zabavil | |
| zabavoval | |
| zabejčil | |
| zabezpečil | |
| zabezpečoval |
This file contains hidden or 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 sys, operator, re | |
| OPMAP = {'+': operator.add, '-': operator.sub, '/': operator.div, '*': operator.mul} | |
| RE_PARSE = re.compile(r'(?P<op>[+\-/\*])\s+(?P<num>\d+)') | |
| def apply(line, prev): | |
| op, num = re.match(RE_PARSE, line.strip('\n')).groups() |
This file contains hidden or 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 argparse | |
| from selenium import webdriver | |
| BROWSERS = dict(phantom=webdriver.PhantomJS, | |
| opera=webdriver.Opera, | |
| firefox=webdriver.Firefox, | |
| chrome=webdriver.Chrome |
This file contains hidden or 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 % cat ~/.config/terminator/config | |
| [global_config] | |
| geometry_hinting = False | |
| enabled_plugins = , | |
| tab_position = hidden | |
| borderless = True | |
| [keybindings] | |
| scaled_zoom = <Shift><Control>u | |
| go_up = <Shift>Up | |
| next_tab = <Shift>Right |