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 program_running(program_name): | |
prgrm = [p.name() for p in psutil.process_iter() if p.name() == program_name] | |
prgrm_is_running = len(r)>0 | |
return prgrm |
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 bar_with_breakline(x, y, plot_type='bar', height_ratios=[10,1], | |
figsize=(10,5), title=None, ylabel=None, xlabel=None): | |
if plot_type == 'bar': | |
pplot = plt.bar | |
elif plot_type == 'line': | |
pplot = plt.plot | |
else: | |
sys.exit('Error: plot type not yet supported, closing') | |
gs = gridspec.GridSpec(2,1, height_ratios=[10,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
def show_progress(loop, loops): | |
print('Progress: [{}/{}]'.format(loop, loops), end='\r') | |
# Example code: | |
prime_numbers = [] | |
for i in range(1e6): | |
for j in range(2,i): | |
if i % j == 0: | |
break |