Skip to content

Instantly share code, notes, and snippets.

@mayurbhangale
Last active September 24, 2019 11:35
Show Gist options
  • Select an option

  • Save mayurbhangale/2b7d7323d78291f23d5f304a16f34bf4 to your computer and use it in GitHub Desktop.

Select an option

Save mayurbhangale/2b7d7323d78291f23d5f304a16f34bf4 to your computer and use it in GitHub Desktop.
Kills ants stuck inside your laptop
from multiprocessing import Pool
from multiprocessing import cpu_count
def f(x):
while True:
x*x
if __name__ == '__main__':
processes = cpu_count()
pool = Pool(processes)
pool.map(f, range(processes))
#stop gracefully when you're done fighting with ants
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment