This file contains 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
# -*- coding: utf-8 -*- | |
import click | |
import logging | |
from pathlib import Path | |
from dotenv import find_dotenv, load_dotenv | |
import requests | |
from bs4 import BeautifulSoup | |
import json | |
import os.path | |
import re |
This file contains 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 numpy as np | |
# B = np.random.randint(-100,100,size=100000) | |
# TODO: kadane's alg. ? | |
B = np.array([[1, 1, 1, 1, 1], | |
[1, 1, 1, 0, 0], | |
[1, 1, 1, 0, 0], |
This file contains 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
def prime_range(n): | |
k = n | |
for i in [1, 2]: | |
if k == 0: | |
break | |
k -= 1 | |
yield i | |
number = 3 | |
while k > 0: | |
if is_prime(number): |
This file contains 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 com.code972.hebmorph.HebrewToken; | |
import com.code972.hebmorph.Lemmatizer; | |
import com.code972.hebmorph.StreamLemmatizer; | |
import com.code972.hebmorph.Token; | |
import com.code972.hebmorph.datastructures.DictHebMorph; | |
import com.code972.hebmorph.hspell.HSpellDictionaryLoader; | |
import lombok.SneakyThrows; | |
import org.apache.poi.ss.usermodel.Cell; | |
import org.apache.poi.ss.usermodel.Row; | |
import org.apache.poi.ss.usermodel.Sheet; |
This file contains 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
def get_range(data, low, high): | |
""" | |
>>> get_range([8, 10, 20, 30, 40, 50, 60, 70, 80, 90], 24, 102) | |
12 | |
""" | |
if len(data) == 0: | |
return high - low | |
bad_numbers = sorted(data) | |
if bad_numbers[0] > low: | |
bad_numbers.append(low) |
This file contains 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
data1 = ["1", "2", "3", "4", "5"] | |
def permute(data): | |
if len(data) <= 1: | |
return data | |
result = [] | |
for i in range(len(data)): | |
item = data[i] | |
tail = data[:i] + data[i + 1:] |
This file contains 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 pandas as pd | |
import numpy as np | |
bigdf = None | |
for i in range(1,87): | |
try: | |
df = pd.read_json('https://raw.githubusercontent.com/fgeorges/star-wars-dataset/master/json/people/{}.json'.format(i)).T | |
except: | |
continue | |
if bigdf is None: |
This file contains 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 pickle | |
import re | |
from datetime import datetime | |
from urllib.parse import quote | |
import requests | |
from bs4 import BeautifulSoup | |
COMMA = "," | |
DOT = "." |
This file contains 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 sys | |
def deprecated(func): | |
def wrapper(*args, **kwargs): | |
print('{} is deprecated'.format(func.__name__), file=sys.stderr) | |
return func(*args, **kwargs) | |
return wrapper | |
@deprecated | |
def add(x, y): |
This file contains 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 pprint | |
import requests | |
import json | |
QUERY = 'meaning' | |
DICTIONARY_API = 'https://dictionary.yandex.net/api/v1/dicservice.json/lookup' | |
YNDX_TMP_KEY = 'dict.1.1.20171114T131015Z.59d0570f825aeb6d.aa00fdbd5ee643a6cb790c0963c0946115ceef55' | |
params = {'key' : YNDX_TMP_KEY, 'lang' : 'en-ru', 'text' : QUERY} |
OlderNewer