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 argparse | |
import bz2 | |
import gzip | |
import logging | |
import os | |
from pathlib import Path | |
from pprint import pformat |
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 bz2 | |
import gzip | |
from Bio import SeqIO | |
def read_fasta(path): | |
if path.endswith('.gz'): |
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 bash | |
# | |
# Usage: ./git_rewind_days.sh <int> | |
set -eux | |
DAYS_TO_REWIND="${1}" | |
COMMIT_DATE=$(git log -1 | sed -ne 's/^Date: \+//p') | |
REWIDED_DATE=$(date -d "${COMMIT_DATE% *} - ${DAYS_TO_REWIND} days" | awk '{print $1" "$2" "$3" "$4" "$6}')" ${COMMIT_DATE##* }" |
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 bash | |
# | |
# https://github.com/dceoy/ansible-dev/blob/master/roles/ruby/files/install_rbenv.sh | |
set -uex | |
RBENV_DIR="${HOME}/.rbenv" | |
RB_BUILD_DIR="${HOME}/.rbenv/plugins/ruby-build" | |
RBENV="${RBENV_DIR}/bin/rbenv" | |
[[ ${#} -ge 1 ]] && RB_MAJOR_VER="${1}" || RB_MAJOR_VER=2 |
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 bash | |
# | |
# https://github.com/dceoy/ansible-dev/blob/master/roles/python/files/install_pyenv.sh | |
set -uex | |
PYENV_DIR="${HOME}/.pyenv" | |
PYENV="${PYENV_DIR}/bin/pyenv" | |
[[ ${#} -ge 1 ]] && PY_MAJOR_VER="${1}" || PY_MAJOR_VER=3 |
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 bash | |
# | |
# Usage: ./install_bio_stack.sh <dest dir path> | |
set -uex | |
PREFIX_DIR=$(realpath "${1}") | |
BIN_DIR="${PREFIX_DIR}/bin" | |
SRC_DIR="${PREFIX_DIR}/src" | |
mkdir -p "${SRC_DIR}" "${BIN_DIR}" |
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 subprocess | |
def run_and_parse_subprocess(**popen_args): | |
with subprocess.Popen(**popen_args) as p: | |
for line in p.stdout: | |
yield line.decode('utf-8') | |
if p.poll() == 0: |
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 bash | |
# | |
# Usage: ./install_cudnn.sh <tar file> | |
set -ex | |
[[ -n "${1}" ]] \ | |
&& tar -xzvf ${1} -C /tmp \ | |
&& cp /tmp/cuda/include/cudnn.h /usr/local/cuda/include \ | |
&& cp /tmp/cuda/lib64/libcudnn* /usr/local/cuda/lib64 \ |
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 numpy as np | |
from scipy import stats | |
class HotellingsT2(object): | |
def __init__(self, alpha): | |
self.anomaly_score_threshold = stats.chi2.ppf(q=(1 - alpha), df=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
#!/usr/bin/env Rscript | |
if(length(argv <- commandArgs(trailingOnly = TRUE)) > 0) { | |
install.packages(pkgs = argv, | |
repos = c(CRAN = 'https://cran.rstudio.com/'), | |
dependencies = TRUE) | |
} else { | |
message('Nothig to do.') | |
} |
NewerOlder