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
""" | |
The MIT License | |
Copyright (c) 2020 Mark Douthwaite | |
""" | |
import time | |
import multiprocessing as mp | |
from tqdm import tqdm |
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
""" | |
MIT License | |
Copyright (c) 2018-2020 Mark Douthwaite | |
Send Email Snippet | |
------------------ | |
Send an email from a given account to a target set of recipients. |
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
""" | |
The MIT License | |
Copyright (c) 2020 Mark Douthwaite | |
Count the number of available CPUs to a process. In the case of containers (e.g. Docker) | |
this will detect resources available to the container -- not the host machine. | |
Note: in cases where _fractional_ CPU values are detected, this will _round up_ to the | |
nearest integer value. |
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
if [ ! -f .env ] | |
then | |
export $(cat .env | xargs) | |
fi |
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
if [ -f .env ] | |
then | |
export $(cat .env | sed 's/#.*//g' | xargs) | |
fi |
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 sample_index(arr: ndarray) -> ndarray: | |
""" | |
Given an *ordered* array of non-negative integers, randomly select one index for | |
each unique element. | |
Parameters | |
---------- | |
arr : ndarray | |
An ordered array of integers. |
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
package main | |
import ( | |
"gonum.org/v1/hdf5" | |
) | |
// load a scalar-valued variable of type int from an attribute of the given name on the given dataset. | |
func getIntScalarAttr(dataset *hdf5.Dataset, attrName string) int { | |
var value int |
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
package main | |
import ( | |
"fmt" | |
"gonum.org/v1/hdf5" | |
"math/rand" | |
"time" | |
) | |