View group-table-cols.r
#' Apply a function over groups of columns.
grouped_columns_apply = function (data, width, fun) {
# Generate the group indices for the columns (see below).
group_indices = group_indices(ncol(data), width)
# For each group, apply `fun` to the columns of its indices.
results = lapply(group_indices, function (indices) fun(data[, indices, drop = FALSE]))
bind_cols(results)
}
# If the number of columns is always evenly divisible by the width, the following
View # glibc - 2017-10-03_18-51-18.txt
Homebrew build logs for glibc on Ubuntu 12.04.5 LTS
Build date: 2017-10-03 18:51:18
View select-lines.cpp
#include <algorithm>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <iterator>
#include <string>
#include <vector>
auto main(int argc, char** argv) -> int {
if (argc < 2) {
View normalize_path.r
#' Replacement for \code{normalizePath} that works with non-existent paths on
#' Unix
#'
#' @param path vector of paths to normalize.
#' @details
#' \code{normalize_path} works like \code{\link[base]{normalizePath}}, but also
#' works on non-existent paths. \code{\link[base]{normalizePath}} has an option
#' \code{mustWork = FALSE} for this; however, that option only works on Windows.
#' On Unix systems, it causes paths to be left untouched. However, and as a
#' consequence, \code{normalize_path} does \emph{not} resolve symlinks.
View test-interactive.r
context('Same as the basic tests, just in an interactive R shell')
play_back_results = function (record_events, onto) {
for (event in record_events) {
switch(event$type,
start_test = onto$start_test(event$context, event$test),
add_result = onto$add_result(event$context, event$test, event$result),
end_test = onto$end_test(event$context, event$test))
}
}
View README.md

Who is touching the .Random.seed?

Inspired by a Stack Overflow question, here’s a way of tracking what’s been modifying the .Random.seed.

Since R makes static analysis impossible in general, the following is a runtime tracer that injects itself into the .Random.seed variable via an active binding:

debug_random_seed()
sample(10)
View remove-mate.pl
#!/usr/bin/env perl
use strict;
use warnings;
my $state = 0; # 0 = ID; 1 = sequence; 2 = repeat ID; 3 = quality
my $seqlen = 0;
while (<>) {
chomp;
View r-launcher.sh
#!/usr/bin/env bash
while getopts ":n:c:q:" option; do
case "$option" in
n)
cores="$OPTARG"
;;
m)
mem="$OPTARG"
;;
View pillows.r
library(dplyr)
library(tidyr)
library(ggplot2)
stages = c('Ordered', '?', 'In transit', 'Arrived', 'Returned')
make_stages = function (status)
factor(status, levels = stages, ordered = TRUE)
pillows = tibble::tribble(
View # util-linux - 2017-02-14_14-50-53.txt
Homebrew build logs for util-linux on Ubuntu 12.04.5 LTS
Build date: 2017-02-14 14:50:53