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 pandas as pd | |
import itertools | |
import time | |
import multiprocessing | |
from typing import Callable, Tuple, Union | |
def groupby_parallel( | |
groupby_df: pd.core.groupby.DataFrameGroupBy, | |
func: Callable[[Tuple[str, pd.DataFrame]], Union[pd.DataFrame, pd.Series]], | |
num_cpus: int = multiprocessing.cpu_count() - 1, |
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
/** | |
* Recommended exit codes from {@code /usr/include/sysexits.h}. | |
*/ | |
public final class ExitStatus { | |
public static final int OK = 0; | |
public static final int GENERIC_ERROR = 1; | |
public static final int BASE = 64; | |
public static final int USAGE = 64; | |
public static final int NO_DATA = 65; | |
public static final int NO_INPUT = 66; |
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
*.backup | |
/data |
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
[metadata] | |
description-file = "README.md" | |
[build-system] | |
requires = ["poetry>=1.0", "coverage[toml]"] | |
build-backend = "poetry.masonry.api" | |
######################################################################################### | |
# Poetry metadata |
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
class FancyCmaps: | |
""" | |
Useful colormaps for matplotlib. Most importantly: | |
- white_red | |
- white_blue | |
- blue_white | |
- white_black | |
The built-in matplotlib ones don't actually go between pure color values!! | |
For ex, 'Greys' doesn't go from pure white to pure black! | |
So colormaps to consider avoiding include Greys, Blues, Greens, (etc), bwr, and seismic. |
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 argparse, sys, re, logging | |
from pathlib import Path | |
from typing import Mapping, Any, Sequence, Collection | |
from typing import Tuple as Tup | |
logger = logging.getLogger('paperpile-latex') | |
class Paperpiler: |
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
[ | |
{ | |
"code": "100", | |
"phrase": "Continue", | |
"description": "The initial part of a request has been received and has not yet been rejected by the server.", | |
"spec_title": "RFC7231#6.2.1", | |
"spec_href": "https://tools.ietf.org/html/rfc7231#section-6.2.1" | |
}, | |
{ | |
"code": "101", |
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 sys | |
import re | |
from pathlib import Path | |
def fix(path: Path, accent_file: Path, output_path: Path) -> None: | |
""" | |
Reformat my bib file. | |
* Remove PMC and DOI URLs because they're listed as IDs anyway. | |
* Replace accent-like escape characters with their UTF equivalents. I mean, it's 2020. |
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
See https://github.com/dmyersturnbull/genomics-io/tree/master/core/src/main/java/org/pharmgkb/parsers/escape | |
package org.pharmgkb.parsers.escape; | |
import com.google.common.base.Preconditions; | |
import com.google.common.collect.ImmutableSet; | |
import javax.annotation.Nonnull; | |
import javax.annotation.concurrent.NotThreadSafe; | |
import javax.annotation.concurrent.ThreadSafe; |
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
// copied from https://github.com/dmyersturnbull/genomics-io/blob/master/core/src/main/java/org/pharmgkb/parsers/utils/HttpHeadResponse.java | |
package org.pharmgkb.parsers.utils; | |
import com.google.common.collect.ImmutableMap; | |
import javax.annotation.Nonnegative; | |
import javax.annotation.Nonnull; | |
import javax.annotation.concurrent.Immutable; | |
import java.io.IOException; | |
import java.net.HttpURLConnection; |
NewerOlder