Skip to content

Instantly share code, notes, and snippets.

@StaticallyTypedRice
StaticallyTypedRice / create_hashfiles_from_filelist.py
Last active September 11, 2019 07:03
Iterate through a file containing a list of line break separated file paths and create files containing hashes of the target files.
#! /usr/bin/env python3
import argparse
import hashlib
def create_hashfiles_from_filelist(filelist, algorithm: str = 'sha3-512'):
'''
Iterate through a list of file paths and create files containing hashes of the target files.
import random
import typing.List
def thanos_sort(a: List[int]) -> List[int]:
'''Removes half of the list until it's perfectly balanced, like all things should be.'''
def _perfectly_balanced(a: List[int]) -> bool:
like_all_things_should_be = True
@StaticallyTypedRice
StaticallyTypedRice / split_string_into_rows.py
Last active May 26, 2018 02:34
A Python function for dividing a single-line string into rows of a specified length.
def split_string_into_rows(string: str, row_length: int = 10) -> str:
''' Splits a string into rows of a specified length.
Rows are separated by \n characters.
NOTE: This function may break if there are already \n characters in the string.
'''
# The character separating the rows
added_character = '\n'