Skip to content

Instantly share code, notes, and snippets.

View yutannihilation's full-sized avatar
🍣
Nobody loves you

Hiroaki Yutani yutannihilation

🍣
Nobody loves you
View GitHub Profile
library(dplyr)
con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
DBI::dbWriteTable(con, "mtcars", mtcars)
mtcars2 <- tbl(con, "mtcars")
mtcars2
mtcars2 %>%
select(cyl) %>%
--- introduction.Rmd 2017-04-13 21:34:20.746708500 +0900
+++ dplyr.Rmd 2017-04-13 21:32:54.691292800 +0900
@@ -1,6 +1,5 @@
---
title: "Introduction to dplyr"
-date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Introduction to dplyr}
@@ -13,6 +12,7 @@
---
title: "Untitled"
output: md_document
---
```{r}
#Sample Dataframe
library(magrittr)
library(dplyr)
library(formattable)
# get all variable names
varnames <- paste0("Var", 1:50)
# get all variable values
varvalues <- sapply(varnames, function(x) get(x, envir = .GlobalEnv))
# calculate new variable values
varvalues_new <- varvalues * 1:50
# assign to the original variables
$ mkdir roots
$ wget -O - https://chromium.googlesource.com/chromium/src/+archive/master/net/data/ssl/symantec/roots.tar.gz | tar -x -f - -C roots/
$ for cert in roots/*.pem; do openssl x509 -inform pem -in $cert -noout -text | grep 'Subject:'; done | sort -u
Subject: C=DE, O=TC TrustCenter GmbH, OU=TC TrustCenter Class 2 CA, CN=TC TrustCenter Class 2 CA II
Subject: C=DE, O=TC TrustCenter GmbH, OU=TC TrustCenter Class 4 CA, CN=TC TrustCenter Class 4 CA II
Subject: C=DE, O=TC TrustCenter GmbH, OU=TC TrustCenter Universal CA, CN=TC TrustCenter Universal CA I
Subject: C=DE, O=TC TrustCenter GmbH, OU=TC TrustCenter Universal CA, CN=TC TrustCenter Universal CA II
Subject: C=DE, O=TC TrustCenter GmbH, OU=TC TrustCenter Universal CA, CN=TC TrustCenter Universal CA III
Subject: C=DE, ST=Hamburg, L=Hamburg, O=TC TrustCenter for Security in Data Networks GmbH, OU=TC TrustCenter Class 1 CA/[email protected]
Subject: C=DE, ST=Hamburg, L=Hamburg
cppfile <- tempfile(fileext = ".cpp")
cat("
#include <Rcpp.h>
using namespace Rcpp;

// [[Rcpp::export]]
std::string std2std(const std::string &x) {
  return x;
}
TokenSony <- R6::R6Class("TokenSony", inherit = Token2.0, list(
init_credentials = function() {
super$init_credentials()
# expires_inは秒数なので、POSIXctにしておく
self$credentials$expires_timestamp <- Sys.time() + self$credentials$expires_in
},
refresh = function() {
super$refresh()
self$credentials$expires_timestamp <- Sys.time() + self$credentials$expires_in
},
臼NG