This file contains hidden or 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(dplyr) | |
library(ggplot2) | |
library(grid) | |
geom_cloud <- function(mapping = NULL, data = NULL, ..., | |
na.rm = FALSE, | |
steps = 5, se_mult=1, max_alpha=1, | |
inherit.aes = TRUE) { |
This file contains hidden or 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
# | |
# docker build --rm -t shabbychef/sc . | |
# | |
# docker run -it --rm -v $(pwd)/muzak:/srv:rw shabbychef/sc "-u" "shabbychef" "-o" "/srv" "-c" "THIS IS YOUR API KEY THINGY AA43" | |
# | |
# Created: 2016.03.07 | |
# Copyright: Steven E. Pav, 2016 | |
# Author: Steven E. Pav | |
# Comments: Steven E. Pav |
This file contains hidden or 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
options(width=160) | |
suppressMessages({ | |
library(fromo) | |
library(roll) | |
library(RcppRoll) | |
library(microbenchmark) | |
library(RollingWindow) | |
}) | |
show(sessionInfo()) |
This file contains hidden or 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
suppressMessages({ | |
library(fromo) | |
library(roll) | |
library(RcppRoll) | |
library(microbenchmark) | |
library(RollingWindow) | |
}) | |
set.seed(1234) | |
df <- data.frame(Adjusted=rnorm(10000)) |
This file contains hidden or 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
# compute the different ways can you express tgt as the sum of a bunch of coins | |
# no greater than maxcoin. assume coins sorted in descending order, | |
# probably does not work great if there is no penny, or negative coins, | |
# or negative tgt. | |
coinrep <- function(tgt,coins=c(25,10,5,1),maxcoin=coins[1]) { | |
stopifnot(tgt >= 0) | |
stopifnot(all(diff(coins) < 0)) # reverse sorted. | |
freecoins <- (coins <= min(maxcoin,tgt)) | |
basev <- rep(0,length(coins)) | |
if (! any(freecoins)) { |
This file contains hidden or 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/r | |
# | |
# Created: 2016.04.26 | |
# Copyright: Steven E. Pav, 2016 | |
# Author: Steven E. Pav <[email protected]> | |
# Comments: Steven E. Pav | |
# generate a new state of the board | |
generate_one <- function(nrow,ncol=nrow,nbombs = 10) { | |
stopifnot(nbombs <= nrow*ncol) |
This file contains hidden or 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(mpoly) | |
# blinnikov and moessner's ADVANCE function | |
advance <- function(kms) { | |
current <- kms$current | |
mold <- kms$mold | |
n <- length(current) | |
ords <- 1:(length(current)) | |
stopifnot(n == sum(current * ords)) |
This file contains hidden or 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(Rcpp) | |
source('yunoparallel.cpp') | |
x <- rnorm(1e5) | |
dumbCount_int(x) | |
dumbCount_int(x) | |
# fine, right? no. | |
replicate(10,dumbCount_int(x)) | |
sd(replicate(100,dumbCount_int(x))) |
This file contains hidden or 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(Rcpp) | |
source('yunoparallel.cpp') | |
x <- rnorm(1e5) | |
dumbCount_int(x) | |
dumbCount_int(x) | |
# seems fine, except ... | |
replicate(10,dumbCount_int(x)) | |
sd(replicate(100,dumbCount_int(x))) |
This file contains hidden or 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 -e | |
# | |
# Created: 2016.02.05 | |
# Copyright: Steven E. Pav, 2016 | |
# Author: Steven E. Pav | |
# Comments: Steven E. Pav | |
function finish() { | |
echo doing cleanup here | |
} |