Skip to content

Instantly share code, notes, and snippets.

View playpauseandstop's full-sized avatar

Igor Davydenko playpauseandstop

View GitHub Profile
@playpauseandstop
playpauseandstop / gist:1818351
Created February 13, 2012 17:08
Logout all active Django sessions
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 / App.tsx
Created September 28, 2021 16:01
Code to reproduce parcel-bundler/parcel#6642 issue
import * as Sentry from '@sentry/react'
import React, { FC, ReactElement } from 'react'
export const App: FC = () => <p>Hello, world!</p>
export const createApp = (): ReactElement => (
<Sentry.ErrorBoundary>
<App />
</Sentry.ErrorBoundary>
)
@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 / fb-friends-diff.py
Created February 7, 2012 01:24
Script to check who of your Facebook friends were removed from FB or unfriend you.
#!/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 January 15, 2011 00:49
Additional wrapper to rsync command with profiles.
#!/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 January 10, 2012 17:39
Add support of optgroups to WTForms' default SelectField class
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 July 14, 2020 14:09
Check latest GitHub actions releases.

check-latest-actions

Check latest GitHub actions releases.

Requirements

@playpauseandstop
playpauseandstop / Dockerfile.pip19
Last active March 7, 2020 22:16
pyproject.toml
FROM playpauseandstop/docker-python:3.2.0-py38
RUN pip install pip==19.2.3
RUN pip install pyheif==0.4
CMD ["python"]
[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 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/)