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 python3 | |
| import re | |
| import os | |
| import time | |
| from bs4 import BeautifulSoup | |
| from urllib.request import urlopen, Request | |
| def get_wikipedia_page(name): | |
| url = 'https://en.wikipedia.org/wiki/%s' % name |
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 python3 | |
| import os | |
| import re | |
| from collections import defaultdict | |
| alphabet = defaultdict(set) | |
| for root, dirs, files in os.walk('texts'): | |
| for file in files: |
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 python3 | |
| import re | |
| from urllib.request import urlopen | |
| url = 'http://hist.hse.ru/persons/' | |
| data = urlopen(url).read().decode() | |
| regexp = r'b-greetings__person_data small">[^>]+>([^<]+)</a><p>([^<]+)<' |
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 python3 | |
| import random | |
| import matplotlib.pyplot as plt | |
| initial = 100 | |
| def check(init, wage, n): | |
| init = init |
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 | |
| import json | |
| import shelve | |
| from urllib2 import urlopen | |
| URL = 'http://54.200.3.128/examples/api.php' | |
| DB_FILENAME = 'data.db' | |
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 python3 | |
| all_commands = {} # dict: name => func | |
| def command(func): | |
| all_commands[func.__name__] = func | |
| return func | |
| @command |
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 python3 | |
| import random | |
| def seed(grid): | |
| for i in range(3, 0, -1): | |
| if 0 in grid[i]: | |
| r = random.randrange(4) | |
| while grid[i][r] != 0: | |
| r = random.randrange(4) |
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 python3 | |
| import random | |
| import string | |
| import time | |
| import sys | |
| import json | |
| while True: |
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 app.config import TWITTER_APP_KEY, TWITTER_APP_SECRET | |
| twitter_oauth = oauth.remote_app( | |
| 'twitter', | |
| consumer_key=TWITTER_APP_KEY, | |
| consumer_secret=TWITTER_APP_SECRET, | |
| base_url='https://api.twitter.com/1.1/', | |
| request_token_url='https://api.twitter.com/oauth/request_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
| # Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key | |
| # that enables you to choose a character from a menu of options. If you are on Lion | |
| # try it by pressing and holding down 'e' in any app that uses the default NSTextField | |
| # for input. | |
| # | |
| # It's a nice feature and continues the blending of Mac OS X and iOS features. However, | |
| # it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode, | |
| # as it means you cannot press and hold h/j/k/l to move through your file. You have | |
| # to repeatedly press the keys to navigate. |