Skip to content

Instantly share code, notes, and snippets.

Avatar

Igor Davydenko playpauseandstop

View GitHub Profile
@playpauseandstop
playpauseandstop / arange.py
Last active Aug 29, 2015
Range function for Decimals and floats and any other objects which supports addition
View arange.py
import operator
def arange(start, stop=None, step=None):
"""
Implement range function not only for integers as Python's builtin
function, but for Decimals and floats as well.
Returns generator with arithmetic progession, not list.
@playpauseandstop
playpauseandstop / pip-list-updates.sh
Last active Aug 29, 2015
Check out available updates for virtual environment or system libraries with pip
View pip-list-updates.sh
#!/bin/bash
#
# Check out available updates for virtual environment or system libraries with
# `pip <http://pip.pypa.org/>`_.
#
# Requirements
# ============
#
# * GNU/Linux, Mac OS X
# * `pip`_ 1.4 or higher
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

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 / 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
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 / Integer.rb
Created Feb 8, 2012
Hey, javascript! Are you fucking kidding me?!
View Integer.rb
>> ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09'].map! {|x| Integer(x)}
ArgumentError: invalid value for Integer: "08"
from (irb):1:in `Integer'
from (irb):1
from (irb):1:in `map!'
from (irb):1
>> ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09'].map! {|x| Integer(Float(x))}
=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
@playpauseandstop
playpauseandstop / settings.py
Created May 2, 2012
Disable Flask's debug logger if testing mode enabled
View settings.py
import logging
import os
DEBUG = False
TESTING = 'TESTING' in os.environ or 'nosetests' in os.environ.get('_', '')
try:
from settings_local import *