Skip to content

Instantly share code, notes, and snippets.

Avatar

Igor Davydenko playpauseandstop

View GitHub Profile
@playpauseandstop
playpauseandstop / gist:1818351
Created Feb 13, 2012
Logout all active Django sessions
View gist:1818351
import datetime
from django.conf import settings
from django.contrib.auth import logout
from django.contrib.auth.models import User
from django.contrib.sessions.models import Session
from django.http import HttpRequest
from django.utils.importlib import import_module
@playpauseandstop
playpauseandstop / Makefile
Last active Aug 3, 2021
Setup aiohttp web app with Session Middleware to use Redis Storage and run under Gunicorn.
View Makefile
.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 / fb-friends-diff.py
Created Feb 7, 2012
Script to check who of your Facebook friends were removed from FB or unfriend you.
View fb-friends-diff.py
#!/usr/bin/env python
#
# Script to check who of your Facebook friends were removed from FB or unfriend
# you.
#
# Requirements
# ============
#
# * Linux / Mac OS X / other Unix
# * `Python <http://www.python.org/>`_ 2.6 or 2.7
@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_
#
@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):
@playpauseandstop
playpauseandstop / README.rst
Last active Jul 14, 2020
Check latest GitHub actions releases.
View README.rst

check-latest-actions

Check latest GitHub actions releases.

Requirements

View Dockerfile.pip19
FROM playpauseandstop/docker-python:3.2.0-py38
RUN pip install pip==19.2.3
RUN pip install pyheif==0.4
CMD ["python"]
View pyproject.toml
[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>"]
@playpauseandstop
playpauseandstop / show-hook-dependencies.sh
Last active Oct 29, 2019
Show latest pre-commit hook dependencies.
View show-hook-dependencies.sh
#!/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/)
@playpauseandstop
playpauseandstop / README.md
Created Jul 10, 2019
Script to update Python version for projects with pyenv & poetry
View README.md

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)