Skip to content

Instantly share code, notes, and snippets.

View e-ruiz's full-sized avatar

Eric S. Lucinger Ruiz e-ruiz

View GitHub Profile
@e-ruiz
e-ruiz / check_cores
Last active June 5, 2021 18:48
check CPU and determine some jobs
# python 3.7+
import multiprocessing
# CPUs disponíveis para esse processo
# @see: https://docs.python.org/3/library/os.html#os.cpu_count
# @see: https://docs.python.org/3/library/multiprocessing.html#multiprocessing.cpu_count
MAX_THREADS = multiprocessing.cpu_count()
# define um mínimo de 1 job e no máximo max_thread-2 jobs
JOBS = MAX_THREADS-2 if MAX_THREADS-2 > 1 else MAX_THREADS-2
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,