Skip to content

Instantly share code, notes, and snippets.

Artur Barseghyan barseghyanartur

Block or report user

Report or block barseghyanartur

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

This works for me:

from enum import Enum
import graphene

class NoValue(Enum):

    def __repr__(self):
barseghyanartur / django_union_snippet.rst
Last active Aug 22, 2019
Django: Select 3 most recent Post objects from 3 different users in a single database query
View django_union_snippet.rst



  • There are a lot of Post objects.
  • There are 3 users.

What we want:

  • Select 3 most recent Post objects from 3 different users.
View find_python_2_7_code.rst
pip install black
black . --target-version=py36 --check --quiet
barseghyanartur / index.rst
Created May 28, 2019
Body weight/height BMI calculation
View index.rst

BMI is weight divided by height in the power of two.

bmi = weight / height**2

Body Mass Index Scale

  • Underweight: less than 18.5
  • Normal weight: 18.5 - 25

Remove old PostGIS Installation

The first step is to remove older version of PostGIS if any.

sudo apt-get purge postgis

Setup repository

wget --quiet -O - | sudo apt-key add -
sudo sh -c 'echo "deb trusty-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
barseghyanartur / instructions.rst
Last active Jan 23, 2019
Find coordinates by postal code
View instructions.rst

Install pgeocode package:

pip install pgeocode

Find the geo coordinates by postal code:

View example.rst
barseghyanartur /
Last active Feb 9, 2019
Minimalistic REST API view
from django.conf.urls import url
from views import sample_api_view
urlpatterns = [
You can’t perform that action at this time.