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 json | |
import os | |
import string | |
import zipfile | |
from lxml import etree | |
from nltk.tokenize import RegexpTokenizer | |
from tqdm import tqdm | |
import docx |
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 csv | |
from datetime import datetime | |
import speedtest | |
def measure_speed(): | |
st = speedtest.Speedtest(secure=True) | |
st.get_best_server() # This will select the best server based on ping |
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
# https://www.codingame.com/ide/puzzle/shadows-of-the-knight-episode-1 | |
import sys | |
import math | |
w, h = [int(i) for i in input().split()] | |
n = int(input()) | |
x0, y0 = [int(i) for i in input().split()] | |
L, R, T, B = 0, w-1, 0, h-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 | |
df1 = pd.read_csv('raw.csv', sep='|') | |
df2 = pd.read_csv('clean_OLD.csv', sep='|') | |
not_clean = list(set(df1['id']) - set(df2['id'])) | |
print(f'Raw DF: {df1.shape}\nClean DF: {df2.shape}\nNot clean: {len(not_clean)}') | |
data = df1[df1['id'].isin(not_clean)].reset_index(drop=True) | |
print(f'Not clean DF: {data.shape}') |
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 os | |
import pickle | |
import warnings | |
from functools import reduce | |
from operator import add | |
import numpy as np | |
import pandas as pd | |
import torch | |
from tqdm import tqdm |
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
# This Python script can be used to generate true Reber grammar sequences. | |
# To generate false Reber grammar sequences, just change tuple values in 'traversal' at line 8. | |
import numpy as np | |
chars = 'BTSXPVE' | |
traversal = [[('T', 'P'), (1, 4)], [('S', 'X'), (1, 2)], [('S', 'X'), (3, 4)], [('E'), (-1,)], [('V', 'T'), (5, 4)], [('V', 'P'), (3, 2)]] | |
def generate_seq(min_length): |
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 solution(secret, guess): | |
while secret != guess: | |
correct_position_guessed = [0] * len(secret) | |
correct_color_guessed = [color for color in secret if color in guess] | |
for i in range(len(secret)): | |
if secret[i] == guess[i]: | |
correct_position_guessed[i] = 1 | |
print('Correct colors guessed: {}'.format(' '.join(color for color in correct_color_guessed))) |
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
# Video link: https://youtu.be/3P3TcKaegbA?list=PLxvWWIq3F0k0GE1EYvricLniNSdv9gvZS | |
import os | |
import time | |
from datetime import datetime | |
from github import Github | |
from curtsies.fmtfuncs import yellow | |
ACCESS_TOKEN = open('token', 'r').read() | |
g = Github(ACCESS_TOKEN) |
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 random, json, requests, string, sys | |
def game(): | |
chain = 0 | |
usedWords = [] | |
answer_Word = None | |
chainGood = True | |
min_length = 3 | |
while chainGood: | |
# if chain != 0 and chain % 5 == 0: min_length += 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 random, time | |
def generate_random_number(): | |
number = list(map(str, str(time.time()).replace('.', ''))) | |
return int(''.join(random.sample(number, len(number)))) | |
print(generate_random_number()) |
NewerOlder