Skip to content

Instantly share code, notes, and snippets.

View kenahoo's full-sized avatar

Ken Williams kenahoo

View GitHub Profile
#include <Rcpp.h>
using namespace Rcpp;
//' Find "detectable change points" in a numeric data frame
//'
//' If you have a huge data frame that you want to do a line-plot of, this
//' function can help down-sample the data to remove consecutive redundancies
//' that would be undetectable in a plot whose resolution is higher than
//' \code{thresh}. It's similar *in spirit* to something like
//' \code{x <- diff(as.matrix(df)); which(apply(x, 1, function(r) any(r>thresh)))},
Process: rsession [91446]
Path: /Applications/RStudio.app/Contents/MacOS/rsession
Identifier: rsession
Version: ???
Code Type: X86-64 (Native)
Parent Process: RStudio [91444]
Responsible: Terminal [283]
User ID: 2025
Date/Time: 2015-06-25 14:15:19.452 -0500
% brew install apache-spark
> Sys.setenv(SPARK_HOME="/usr/local/Cellar/apache-spark/1.4.1/libexec")
> .libPaths(c(file.path(Sys.getenv("SPARK_HOME"), "R", "lib"), .libPaths()))
> library(SparkR)
> sc <- sparkR.init(master="local")
{
"Append RAqua libs to R_LIBS" = NO;
"ApplicationCrashedAfterRelaunch" = 0;
"auto.close.parens" = YES;
"Background Color" = <040b7374 7265616d 74797065 6481e803 84014084 8484074e 53436f6c 6f720084 84084e53 4f626a65 63740085 84016301 84046666 66660101 010186>;
"Cleanup history entries" = YES;
"Console Font Size" = 10;
"default.CRAN.mirror.save.dontask" = NO;
"default.CRAN.mirror.URL" = "http://streaming.stat.iastate.edu/CRAN";
"Disable R signal handlers" = NO;
% pkgutil --verify org.tug.mactex.texlive2015
Verifying files from package 'org.tug.mactex.texlive2015' on '/'.
Group differs on "usr/local", should be 0, group is 80.
Permissions differ on "usr/local", should be drwxr-xr-x , they are drwxrwxr-x .
Group differs on "usr/local/texlive/2015/LICENSE.CTAN", should be 0, group is 704.
Group differs on "usr/local/texlive/2015/LICENSE.TL", should be 0, group is 704.
Group differs on "usr/local/texlive/2015/README", should be 0, group is 704.
Group differs on "usr/local/texlive/2015/README.usergroups", should be 0, group is 704.
Group differs on "usr/local/texlive/2015/bin/universal-darwin", should be 0, group is 704.
User differs on "usr/local/texlive/2015/bin/universal-darwin/makeglossaries", should be 501, user is 0.
> packrat::init(options = list(use.cache=TRUE))
Initializing packrat project in directory:
- "/Users/kwilliams/git/fpdc/src/main/R/FPDC"
Adding these packages to packrat:
_
AMGUtils 0.5.32
BayesX 0.2-9
FNN 1.1
Formula 1.2-1
@kenahoo
kenahoo / Rcpp-DataFrame.R
Last active December 13, 2015 23:28
Rcpp for DataFrame access
library(Rcpp)
cppFunction('
int countSteps (DataFrame df, double thresh=0.001) {
int out = 0;
if(df.nrows()==0) return out;
int last_i = 0;
out++;
This is pdfTeX, Version 3.1415926-2.3-1.40.12 (MiKTeX 2.9) (preloaded format=latex 2012.3.25) 18 SEP 2013 13:21
entering extended mode
**c:/Users/KWILLI?1/AppData/Local/Temp/orgtex6488Qq2.tex
(c:/Users/KWILLI~1/AppData/Local/Temp/orgtex6488Qq2.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, afrikaans, ancientgreek, ar
abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic,
croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga
lician, german, german-x-2009-06-19, greek, gujarati, hindi, hungarian, iceland
ic, indonesian, interlingua, irish, italian, kannada, kurmanji, lao, latin, lat
My task:
- name: Download standard stuff
s3:
bucket: my-bucket
object: /bootstrap/foo.tgz
dest: /tmp/foo.tgz
mode: get
% GIT_TRACE=1 GIT_SEQUENCE_EDITOR='perl -pi -e "s/^keep/reword/m"' GIT_EDITOR='perl -pi -e "s/BB-123/BB-456/g"' git rebase -i develop
20:17:44.091418 git.c:576 trace: exec: 'git-rebase' '-i' 'develop'
20:17:44.092305 run-command.c:626 trace: run_command: 'git-rebase' '-i' 'develop'
20:17:44.108977 git.c:344 trace: built-in: git 'rev-parse' '--parseopt' '--stuck-long' '--' '-i' 'develop'
20:17:44.120449 git.c:344 trace: built-in: git 'rev-parse' '--git-dir'
20:17:44.127989 git.c:344 trace: built-in: git 'rev-parse' '--git-path' 'objects'
20:17:44.133395 git.c:344 trace: built-in: git 'rev-parse' '--is-bare-repository'
20:17:44.144873 git.c:344 trace: built-in: git 'rev-parse' '--show-toplevel'
20:17:44.153359 git.c:344 trace: built-in: git 'config' '--bool' 'rebase.stat'
20:17:44.159078 git.c:344 trace: built-in: git 'config' '--bool' 'rebase.autostash'