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
http://www.python.org/dev/peps/pep-0350/ |
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
import smtpd | |
import asyncore | |
server = smtpd.DebuggingServer(('127.0.0.1', 1025), None) | |
asyncore.loop() |
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 |
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 github2.client import Github | |
from csv import reader as CsvReader | |
# FILL INFORMATION BELOW | |
# your username at github | |
GITHUB_USERNAME = "" | |
# your api token, you can find it at https://github.com/account/admin | |
GITHUB_API_TOKEN = "" |
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
""" | |
Mirat Can Bayrak / 2009 | |
""" | |
from urllib import urlopen, urlretrieve | |
from datetime import date as Date | |
from datetime import timedelta | |
from xml.dom import minidom | |
from os.path import basename | |
import re |
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 os import uname, getcwd | |
from os.path import join | |
MACHINE_NAME = uname()[1] | |
if MACHINE_NAME == "XXX.webfaction.com": | |
DOCUMENT_ROOT = "/path/to/document/" | |
DATABASE_ENGINE = ... | |
DATABASE_NAME = ... | |
DATABASE_USER = ... | |
DATABASE_PASSWORD = ... |
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
[sql] SELECT ... | |
FROM "looks_look" | |
[sql] SELECT ... | |
FROM "thumbnail_kvstore" | |
WHERE "thumbnail_kvstore"."key" = sorl-thumbnail||image||da518127fcee31e22ccffa7532bd4008 | |
[sql] SELECT ... | |
FROM "thumbnail_kvstore" | |
WHERE "thumbnail_kvstore"."key" = sorl-thumbnail||image||da518127fcee31e22ccffa7532bd4008 | |
[sql] INSERT INTO "thumbnail_kvstore" ("key", | |
"value") |
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.contrib import admin | |
from django.contrib.flatpages.models import FlatPage | |
# Override flatpage admin | |
class FlatPageAdmin(admin.ModelAdmin): | |
class Media: | |
js = ('/media/j/jquery.js', | |
'/media/j/admin_enhancements.js') | |
css = {'screen': ('/media/c/admin.css',)} | |
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
import urllib2 | |
from BeautifulSoup import BeautifulSoup | |
from subprocess import call | |
for id in range(19, 54): | |
page = urllib2.urlopen("https://www.coursera.org/modelthinking/lecture/preview_view?lecture_id=%s" % id) | |
soup = BeautifulSoup(page) | |
video_tag = soup.find("source", attrs={'type': "video/ogg"}) | |
call(["wget", "%s" % video_tag['src']]) | |
OlderNewer