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
""" | |
Python parallelism demo | |
Run this file with `python parallel-demo.py` to see how different | |
parallelism strategies fare with different kinds of parallism. | |
This requires aiohttp (pip install aiohttp) and requests (pip install requests) | |
Two environment variables control behavior: |
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
""" | |
PPA - Progress Parallel Apply | |
A quick tool for parallel apply in python using multiprocessing. | |
""" | |
import functools | |
import multiprocessing as mp | |
from typing import Dict, Iterable, NamedTuple, Optional, Tuple, Union |
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/env sh | |
# Check missing references extension for proper functioning. | |
set +ex +o pipefail | |
DOCS=$(dirname $(dirname $0)) | |
# Test first by writing the missing references file | |
git checkout $DOCS/conf.py | |
git checkout lib |
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/env sh | |
docker run --rm --name local-postgres -e POSTGRES_PASSWORD=$(op get item "local postgres" | jq -r '.details.password') -d -p 5432:5432 -v "$HOME/Documents/postgres/data:/var/lib/postgresql/data" postgres |
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/env python | |
import click | |
import re | |
import os | |
import contextlib | |
@contextlib.contextmanager | |
def backup_file(file, mode='w', replace=False): | |
"""Open a backup file for writing""" |
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/env python | |
# | |
# pushover.py | |
# Send yourself notifications via https://pushover.net | |
# Just set your pushover user ID to PUSHOVER_USER_ID | |
# and your application API token to PUSHOVER_API_TOKEN | |
# then call this script with the message you want to | |
# send:: | |
# | |
# $ make test; pushover.py "make test finished!" |
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 resample_spectrum(source_wavelength, source_spectrum, destination_wavelengths, destination_resolution): | |
"""Resample a spectrum to a new wavelength grid, possibly degrading the spectrum's resoltuion. | |
:param source_wavelength: The source wavelength array. | |
:param source_spectrum: The source spectrum array. | |
:param destination_wavelengths: The destination wavelength array. | |
:param destination_resolution: The destination resolution. | |
:returns: The resampled spectrum. | |
This function is definitely valid for making a spectrum worse. Doing anything else is questionable. |
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
function setup_OSIRIS { | |
export OSIRIS_ROOT=$1 | |
export OSIRIS_WROOT=${2:-$OSIRIS_ROOT} | |
# Location of data files | |
export OSIRIS_DRP_DATA_PATH=$OSIRIS_WROOT/data/ | |
# Set the queue directory for any pipelines started by this user | |
export DRF_QUEUE_DIR=$OSIRIS_WROOT/drf_queue |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder