This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
from django.http.request import validate_host | |
from django.middleware.csrf import _sanitize_token, constant_time_compare | |
from tastypie.authorization import ReadOnlyAuthorization | |
from tastypie.authentication import Authentication | |
from urlparse import urlparse | |
class InternalResourceAuthentication(Authentication): | |
def is_authenticated(self, request, **kwargs): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# archey [version 0.1-11] | |
# | |
# Maintained by Melik Manukyan <[email protected]> | |
# Distributed under the terms of the GNU General Public License v3. | |
# See http://www.gnu.org/licenses/gpl.txt for the full license text. | |
# | |
# System information tool for Archlinux written in python. | |
#-----------------Customized For Ubuntu---------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3.2 | |
from itertools import combinations | |
""" | |
You have 40 bowls, all placed in a line at exact intervals of 1 meter. You also have 9 oranges. You wish to place all the oranges in the bowls, no more than one orange in each bowl, so that there are no three oranges A, B, and C such that the distance between A and B is equal to the distance between B and C. How many ways can you arrange the oranges in the bowls?. | |
(http://www.bittorrent.com/company/about/developer_challenge) | |
""" | |
def find_count(orange_count=9,cup_count=40,start_point=0,l=[]): | |
""" | |
orange_count: how many oranges should be placed in cups. for our question it is 9. | |
cup_count: how many cups should be used |