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
Creative Commons Legal Code | |
CC0 1.0 Universal | |
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE | |
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN | |
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS | |
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES | |
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS | |
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM |
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://stackoverflow.com/q/76039888/570918 | |
diffmat <- function(drow_margin, dcol_margin, freeze=TRUE) { | |
nrow <- length(drow_margin) | |
ncol <- length(dcol_margin) | |
rmat <- matrix(drow_margin, nrow, ncol) | |
cmat <- matrix(dcol_margin, nrow, ncol, byrow=TRUE) | |
dmat <- 0.5*(rmat + cmat) | |
if (freeze) { | |
## keep satisfactory rows and columns fixed |
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 -l | |
#' Usage: `bash -l new-cran-pkg.sh {r-package}` | |
#' Purpose: Generates a Conda Forge recipe using `conda_r_skeleton_helper` and | |
#' pushes this to a personal fork of `staged-recipes`. | |
#' Notes: Should be located in and run from a `staged-recipes` clone prefix. | |
#' `git remote -v` should show `origin` set to a personal fork | |
#' and `upstream` set to '[email protected]:conda-forge/staged-recipes.git'. | |
#' CRAN package name should be prefixed with 'r-' and given in all lowercase. | |
set -xe -o pipefail |
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 -l | |
## PARAMS | |
## file should have one "[name]=[version]=[build]" per line | |
FILE_PKG_BUILDS="r-tiff.cf_pkgs.txt" | |
## | |
DYLIB_LOC="lib/R/library/tiff/libs" | |
tmp=$(mktemp -d) |
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
library(rhdf5) | |
library(tidyverse) | |
read_ad_df <- function (file, name) { | |
x_attrs <- h5readAttributes(file, name) | |
## check requested entry is a dataframe | |
## TODO: do we need to check encoding-version? | |
stopifnot(x_attrs[['encoding-type']] == "dataframe") | |
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
#!/bin/bash | |
## space-separated input | |
## -n1: run each separately | |
## -P6: run up to 6 in parallel | |
## -I '{}': replace {} with argument | |
## \$ delays evaluation to bash execution | |
## waits randomly for up to five seconds, then prints | |
echo {1..12} |\ | |
xargs -n1 -P6 -I '{}' \ | |
bash -c "sleep \$[ \$RANDOM % 5 ]; echo {}" |
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
################################################################################# | |
# INSTALL MAMBA ON GOOGLE COLAB | |
################################################################################# | |
! wget -O miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py37_4.10.3-Linux-x86_64.sh | |
! chmod +x miniconda.sh | |
! bash ./miniconda.sh -b -f -p /usr/local | |
! rm miniconda.sh | |
! conda config --add channels conda-forge | |
! conda install -y mamba | |
! mamba update -qy --all |
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
#!/bin/sh | |
sudo launchctl kickstart -k system/com.apple.audio.coreaudiod |
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
#!/bin/bash -l | |
# use tmp dir to avoid name conflicts | |
tmp=$(mktemp -d) | |
# solve environment, ignoring existing cache | |
CONDA_PKGS_DIRS=$tmp conda create -dp $tmp/0 --json "$@" |\ | |
# filter to tarball URLs | |
grep '"url"' | grep -oE 'https[^"]+' |\ | |
# download locally | |
xargs wget -c |
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
#!/bin/bash -le | |
# Usage: ./conda-archive.sh foo | |
# Result: creates "foo.full.yaml", "foo.min.yaml", and removes "foo" environment | |
echo "Archiving environment '$1' to YAML" | |
conda env export -vn $1 > $1.full.yaml | |
conda env export -vn $1 --from-history > $1.min.yaml |
NewerOlder