Skip to content

Instantly share code, notes, and snippets.

View raczben's full-sized avatar

Benedek Racz raczben

View GitHub Profile
@raczben
raczben / pool.py
Created February 18, 2021 12:56 — forked from nfaggian/pool.py
Multiprocessing example
from __future__ import print_function
import multiprocessing
import ctypes
import numpy as np
def shared_array(shape):
"""
Form a shared memory numpy array.
@raczben
raczben / argparse_files.py
Last active November 20, 2020 08:40 — forked from 89465127/argparse_files.py
Get a list of filenames using argparse (updated to use default formatter)
import argparse
import os
import glob
def main():
#Does not currently have support to read files from folders recursively
parser = argparse.ArgumentParser(description='Read in a file or set of files, and return the result.', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('path', nargs='+', help='Path of a file or a folder of files.')
parser.add_argument('-e', '--extension', action='append', default=[''], help='File extension to filter by.')
args = parser.parse_args()