Skip to content

Instantly share code, notes, and snippets.

View playpauseandstop's full-sized avatar

Igor Davydenko playpauseandstop

View GitHub Profile
@playpauseandstop
playpauseandstop / ralc.py
Created November 1, 2012 09:46
Rates calculator
#!/usr/bin/env python
#
# Rates calculator.
#
# Requirements
# ============
#
# * `Python <http://www.python.org/>`_ 2.7
#
# Installation
@playpauseandstop
playpauseandstop / bench_django_memcached.py
Created November 1, 2012 14:22
Bench for getting data from Memcached via Django cache
#!/usr/bin/env python
import copy
import sys
import time
from argparse import ArgumentParser
from random import choice
from string import digits, letters
@playpauseandstop
playpauseandstop / posterous-to-blogger.py
Created April 25, 2013 14:14
Import posts from Posterous backup to Blogger account.
#!/usr/bin/env python
#
# Import posts from Posterous backup to Blogger account.
#
# Requirements
# ============
#
# * `Python <http://www.python.org/>` 2.6 or 2.7
# * `GData <http://pypi.python.org/pypi/gdata>`_ 2.0.17 or higher
#
@playpauseandstop
playpauseandstop / arange.py
Last active August 29, 2015 13:56
Range function for Decimals and floats and any other objects which supports addition
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 August 29, 2015 14:04
Check out available updates for virtual environment or system libraries with pip
#!/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
@playpauseandstop
playpauseandstop / Makefile
Last active August 3, 2021 18:22
Setup aiohttp web app with Session Middleware to use Redis Storage and run under Gunicorn.
.PHONY: clean distclean install run
ENV ?= env
VENV = $(shell python -c "import sys; print(int(hasattr(sys, 'real_prefix')));")
ifeq ($(VENV),1)
GUNICORN = gunicorn
else
GUNICORN = $(ENV)/bin/gunicorn
endif
@playpauseandstop
playpauseandstop / env-pip-check
Last active July 9, 2016 09:44
Tiny wrapper around pip-check cmd, to run it inside venv Python first
#!/bin/bash
#
# Tiny shell script to run ``pip-check`` cmd inside of venv or fallback to
# global ``pip-check`` after.
#
# `pip-check <https://github.com/bartTC/pip-check/>`_ is a tool for checking
# outdated versions installed in your Python virtual environment or global
# site packages.
#
# Usage
@playpauseandstop
playpauseandstop / README.md
Created July 10, 2019 21:20
Script to update Python version for projects with pyenv & poetry

update-python.sh

Script to update Python version for projects with pyenv & poetry

Pre-requisites

This script intended to be run for projects which,

  1. Has .pyenv-version file (Python version managed by pyenv)
  2. Can be installed with make install (or make install-api)
@playpauseandstop
playpauseandstop / show-hook-dependencies.sh
Last active October 29, 2019 20:44
Show latest pre-commit hook dependencies.
#!/bin/bash
#
# Script to show list of dependencies for pre-commit hook.
#
# Requirements
# ============
#
# - [curl](https://curl.haxx.se/)
# - [jq](https://stedolan.github.io/jq/)
# - [npm](https://www.npmjs.com/)
[tool.black]
exclude = "^.*/migrations/.*$"
line_length = 79
target_version = ["py37"]
[tool.poetry]
name = "project"
version = "1.0.0"
description = "Project"
authors = ["Team <team@googlegroups.com>"]