Skip to content

Instantly share code, notes, and snippets.

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():
@starenka
starenka / gist:9466644
Last active August 29, 2015 13:57
ph what p?
'''
<?php
$array = array_fill(0,10000, "ahoj");
$count = 0;
$length = 0;
foreach($array as $item) {
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
#!/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()
#!/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
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
starenka /tmp % time lein -v
Leiningen 2.3.4 on Java 1.8.0_05 Java HotSpot(TM) 64-Bit Server VM
lein -v 1.95s user 0.09s system 130% cpu 1.566 total
starenka /tmp % time lein -v
Leiningen 2.3.4 on Java 1.8.0_05 Java HotSpot(TM) 64-Bit Server VM
lein -v 1.99s user 0.06s system 130% cpu 1.574 total
starenka /tmp % time lein -v
Leiningen 2.3.4 on Java 1.8.0_05 Java HotSpot(TM) 64-Bit Server VM
lein -v 1.98s user 0.08s system 125% cpu 1.641 total
starenka /tmp % time lein -v
1 2 3 4
A |---|-O-|---|---|
E |---|---|-O-|---|
C |---|-O-|---|---|
G |---|---|---|---|
w/ same shape:
~~~~~~~~~~~~[ C ]~~~~~~~~~~~~~
4 5 6 7 8 9
root kosmik0 /tmp # cat /etc/apt/preferences.d/iceweasel
Package: iceweasel
Pin: release o=Debian,a=experimental
Pin-Priority: 800
root kosmik0 /tmp # cat /etc/apt/preferences.d/testing
Package: *
Pin: release o=Debian,a=testing
Pin-Priority: 900
(defun epic-split ()
"[x|x + term]"
(interactive)
(delete-other-windows)
(split-window-vertically (floor (* 0.75 (window-height))))
(split-window-right (floor (* 0.5 (window-width))))
(other-window 2)
(get-term)
(other-window 1))