Skip to content

Instantly share code, notes, and snippets.

View pythoneast's full-sized avatar

Ali pythoneast

  • Akvelon
  • Krakow
View GitHub Profile
@pythoneast
pythoneast / taxi.sql
Created February 16, 2021 06:58
Exam solution
--1)
-----------------------------------------------
createdb kurut_taxi -- in terminal
# или
CREATE DATABASE kurut_taxi; -- in psql
-----------------------------------------------
hfgfhfjghf
@pythoneast
pythoneast / permissions.py
Created September 18, 2019 05:20
Group based permissions for Django Rest Framework
from django.contrib.auth.models import User, Group
from rest_framework import permissions
def is_in_group(user, group_name):
try:
return Group.objects.get(name=group_name).user_set.filter(id=user.id).exists()
except Group.DoesNotExist:
return False
class HasGroupPermission(permissions.BasePermission):
@pythoneast
pythoneast / the_minion_game.py
Created May 10, 2018 04:37
The minion game
S = input("Type your word: ").upper()
n = len(S)
stuart = 0
kevin = 0
vowels = ('A', 'E', 'I', 'O', 'U')
for i in range(n):
if S[i] in vowels:
kevin += n - i
@pythoneast
pythoneast / Update remote repo
Created March 29, 2018 04:36 — forked from mandiwise/Update remote repo
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket
@pythoneast
pythoneast / Update remote repo
Created March 29, 2018 04:36 — forked from mandiwise/Update remote repo
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket
@pythoneast
pythoneast / stacktrace.py
Created October 4, 2017 04:49
Bug in order details page
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8003/api/v1/orders/1585
Django Version: 1.11.5
Python Version: 2.7.13
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',