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 random | |
from tqdm import tqdm | |
from time import sleep | |
RANDOM_SEED = 42 | |
random.seed(RANDOM_SEED) | |
datasets = os.listdir('./datasets') |
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 random | |
from sklearn.model_selection import train_test_split | |
# LOCAL FILES | |
ROOT_DATASET_DIR = '/home/simon/Desktop/datasets' | |
print(os.listdir(ROOT_DATASET_DIR)) |
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
class OutputFileGenerator: | |
def __init__(self, file_name='output.out'): | |
self._file_name = file_name | |
self._data = [] | |
def add_slice(self, row_a, column_a, row_b, column_b): | |
self._data.append((row_a, column_a, row_b, column_b)) | |
def write_to_file(self): | |
with open(self._file_name, 'w') as output_file: |
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 | |
default_filename = 'example.in' | |
current_folder = os.path.dirname(os.path.realpath(__file__)) | |
data_folder = os.path.join(current_folder, 'data') | |
class InputParser: | |
def __init__(self, file_name=default_filename): |
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 json | |
files = os.listdir(os.path.dirname(os.path.abspath(__file__))) | |
files = [file for file in files if not file == 'countguides.py'] | |
print('File count: {}'.format(len(files))) | |
guide_purchase_amount = 0 | |
total_spent = 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
import os | |
import subprocess | |
files = os.listdir(os.getcwd()) | |
for file in files: | |
if not file.endswith('.m4a'): | |
continue | |
subprocess.call(['ffmpeg', '-i', file, '-acodec', 'libmp3lame', '-ab', '320k', file.replace('.m4a', '.mp3')]) |
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 praw | |
import OAuth2Util | |
import csv | |
version = '1.0' | |
user_agent = 'raspberrypi:sockb0t259:v{} (by /u/Always_SFW)'.format(version) | |
print('Initialising') | |
print('Connecting to Reddit') | |
r = praw.Reddit(user_agent=user_agent) | |
o = OAuth2Util.OAuth2Util(r, server_mode=True) |