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
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
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
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / |
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
xcode-select --install |
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 unittest | |
import os | |
def read_file(name): | |
with open(name, 'r') as file: | |
return file.read() | |
class TestCreateDeleteFile(unittest.TestCase): | |
def setUp(self) -> None: |
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 unittest | |
def add(x, y): | |
return x + y | |
class TestAddFunction(unittest.TestCase): | |
def test_add_numbers(self): | |
result = add(2, 2) | |
self.assertEqual(result, 4, "Bad Number") |
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 unittest | |
def add(x, y): | |
return x + y | |
class TestAddFunction(unittest.TestCase): | |
def test_add_numbers(self): | |
result = add(2, 2) | |
self.assertEqual(result, 4, "Whoops") |
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
from multiprocessing import Process, Queue, current_process | |
def count(min, max, queue): | |
print(f"Started {current_process().name}") | |
this_list = [] | |
index = 0 | |
for i in range(min, max): | |
this_list.insert(index, i) |
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 multiprocessing | |
import time | |
numbers = range(100000, 1000000, 10000) | |
lock = multiprocessing.Lock() | |
def task(number): | |
global lock | |
print(f"Executing new Task with process {multiprocessing.current_process().pid}") |
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
cpus_to_use = 8 | |
num_cpus = os.cpu_count() | |
if cpus_to_use > num_cpus: | |
cpus_to_use = num_cpus | |
pool = multiprocessing.pool(cpus_to_use) |
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 multiprocessing | |
import time | |
numbers = range(100000, 1000000, 10000) | |
def task(number): | |
print(f"Executing new Task with process {multiprocessing.current_process().pid}") |