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
# pylint: disable=E0401,E1002 | |
import array | |
import functools | |
import dbus | |
import dbus.exceptions | |
import dbus.mainloop.glib | |
import dbus.service | |
import pprint | |
try: | |
from gi.repository import GObject as gobject |
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
.grid-stack > .grid-stack-item { min-height: 60px } | |
.grid-stack > .grid-stack-item[data-gs-height="1"] { height: 60px } | |
.grid-stack > .grid-stack-item[data-gs-height="2"] { height: 140px } | |
.grid-stack > .grid-stack-item[data-gs-height="3"] { height: 220px } | |
.grid-stack > .grid-stack-item[data-gs-height="4"] { height: 300px } | |
.grid-stack > .grid-stack-item[data-gs-height="5"] { height: 380px } | |
.grid-stack > .grid-stack-item[data-gs-height="6"] { height: 460px } | |
.grid-stack > .grid-stack-item[data-gs-height="7"] { height: 540px } | |
.grid-stack > .grid-stack-item[data-gs-height="8"] { height: 620px } | |
.grid-stack > .grid-stack-item[data-gs-height="9"] { height: 700px } |
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
# -*- coding: utf-8 -*- | |
# | |
# Author: Pavel Reznikov <[email protected]> | |
# Created: 10/6/11 | |
# | |
# Id: $Id$ | |
from datetime import datetime, timedelta |
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 django.contrib.auth.models import User, SiteProfileNotAvailable | |
from django.core.exceptions import ImproperlyConfigured | |
from django.db import models | |
from django.db.models.signals import post_init | |
from django.dispatch.dispatcher import receiver | |
@receiver(post_init, sender=User) | |
def user_post_init(sender, instance, **kwargs): | |
def get_profile(): |
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 split_on_packets(iterable, packet_size): | |
''' | |
>>> a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] | |
>>> list(split_on_packets(a, 3)) | |
[[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11]] | |
>>> list(split_on_packets(a, 13)) | |
[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]] | |
>>> list(split_on_packets(a, 1)) |
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
### PROMPT #################### | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" | |
} |
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
{ | |
"WA": { | |
"name": "Washington", | |
"counties": [ | |
"Adams", | |
"Asotin", | |
"Benton", | |
"Chelan", | |
"Clallam", | |
"Clark", |
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 calendar | |
from datetime import datetime, date | |
def inc_months(d, value, specifying_date=None): | |
''' | |
Adds `value` of months to the date `d`. If `specifying_date` is passed, the day of resulting month | |
will be taken from the `specifying_date` instead of `d`. | |
>>> inc_months(datetime(2010, 3, 31), 0) |