Skip to content

Instantly share code, notes, and snippets.

Avatar

Igor Davydenko playpauseandstop

View GitHub Profile
View flickrinfo.py
#!/usr/bin/env python
import pprint
import re
import sys
try:
from flickrapi import FlickrAPI
from flickrapi.exceptions import FlickrError
except ImportError:
View Tddspry Refactor docs.rst

tddspry

Utilities to test Django applications with nosetests and twill.

TestCases

NoseTestCase

@playpauseandstop
playpauseandstop / stringmethods.py
Created Dec 1, 2009
Make possible to use all Python string methods as Django template filters
View stringmethods.py
"""
=============
stringmethods
=============
Make possible to use all Python string methods as Django template filters. Also
provide custom template tag ``{% stringmethod %}`` to use methods with more
than one argument, like ``format``, ``count`` and other.
Restrictions
View bootstrap.py
#!/usr/bin/env python
"""
Bootstrap project using virtualenv_ and pip_. This script will create new
virtual environment if needed and will install all requirements there.
.. _virtualenv: http://pypi.python.org/pypi/virtualenv
.. _pip: http://pypi.python.org/pypi/pip
"""
@playpauseandstop
playpauseandstop / django-picklefield.py
Created Mar 31, 2010
Custom Django model field to store pickled Python objects.
View django-picklefield.py
from django.conf import settings
from django.db import models
from django.utils.encoding import smart_str
if hasattr(settings, 'USE_CPICKLE'):
import cPickle as pickle
else:
import pickle
@playpauseandstop
playpauseandstop / clean-chrome-thumbnails.py
Created Dec 25, 2010
Simple script to clean (remove) all thumbnails for sites placed at "Most visited" section of Google Chrome or Chromium new page.
View clean-chrome-thumbnails.py
#!/usr/bin/env python
#
# Simple script to clean (remove) all thumbnails for sites placed at "Most
# visited" section of Google Chrome or Chromium new page.
#
# Installation
# ============
#
# Store this script somewhere in your ``$PATH`` (like ``~/bin/`` or
# ``/usr/local``).
@playpauseandstop
playpauseandstop / xbmc-update.sh
Created Jan 11, 2011
Script to pull fresh XBMC source, compile and install it.
View xbmc-update.sh
#!/bin/sh
#
# Script to pull fresh XBMC source, compile and install it.
#
# Requirements
# ============
#
# * Cloned XBMC git repo
# * All requirements for build XBMC from source
# * git
@playpauseandstop
playpauseandstop / sync-it
Created Jan 15, 2011
Additional wrapper to rsync command with profiles.
View sync-it
#!/usr/bin/env python
#
# Additional wrapper to ``rsync`` command with profiles.
#
# Requirements
# ============
#
# * Python_ 2.4 or higher
# * rsync_
#
View randdecimal.py
import unittest
from decimal import Decimal
from random import randint
class TestRandDecimal(unittest.TestCase):
def check(self, a, b):
value = randdecimal(a, b)
@playpauseandstop
playpauseandstop / wtforms_extended_selectfield.py
Created Jan 10, 2012
Add support of optgroups to WTForms' default SelectField class
View wtforms_extended_selectfield.py
from wtforms.fields import SelectField as BaseSelectField
from wtforms.validators import ValidationError
from wtforms.widgets import HTMLString, html_params, escape
from wtforms.widgets import Select as BaseSelectWidget
__all__ = ('SelectField', 'SelectWidget')
class SelectWidget(BaseSelectWidget):