Skip to content

Instantly share code, notes, and snippets.

View Gera3dartist's full-sized avatar
🏠
Working from home

Andrii Gerasymchuk Gera3dartist

🏠
Working from home
View GitHub Profile
@Gera3dartist
Gera3dartist / gist:e0e0bef739fc0bc95a2d
Last active September 7, 2015 21:41 — forked from Suor/gist:876324
QuerySet which returns namedtuples
from itertools import imap
from collections import namedtuple
from django.db.models.query import QuerySet, ValuesQuerySet
class NamedTuplesQuerySet(ValuesQuerySet):
def iterator(self):
# Purge any extra columns that haven't been explicitly asked for
extra_names = self.query.extra_select.keys()
@Gera3dartist
Gera3dartist / shortest_path.py
Created March 27, 2018 20:52
simple implementation of dijkstra algorithm
"""
Reference: http://alexhwoods.com/dijkstra/
"""
import collections
import math
class Graph:
"""
Reference: http://alexhwoods.com/dijkstra/
"""
import collections
import math
class Graph:
"""
Reference: https://www.python-course.eu/python3_generators.php
"""
def fibonacci():
""" generates fib sequence """
a,b = 0,1
while 1:
yield a