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 | |
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 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 | |
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 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 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 | |
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 re | |
import json | |
from urllib.request import urlopen | |
start, finish = int(input('Start thread number: ')), int(input('Finish thread number: ')) | |
url = 'http://www.forumishqiptar.com/threads/%d' | |
def find_posts(text): |
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 sys | |
import re | |
if len(sys.argv) < 3: | |
print("Usage: %s file_to_read file_to_write" % sys.argv[0]) | |
exit(1) |
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
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
int main() | |
{ | |
int count[3]; | |
int tables = 0; | |
cin >> count[0] >> count[1] >> count[2]; |