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(httr) | |
endpoint <- "https://api.noopschallenge.com/hexbot" |
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
# Separate LHS and RHS rules | |
r1$rulecount <- as.character(r1$rule) | |
max_col <- max(sapply(strsplit(r1$rulecount,' => '),length)) | |
r_sep <- separate(data = r1, col = rule, into = paste0("Time",1:max_col), sep = " => ") | |
r_sep$Time2 <- substring(r_sep$Time2,3,nchar(r_sep$Time2)-2) | |
# Strip LHS baskets | |
max_time1 <- max(sapply(strsplit(r_sep$Time1,'},'),length)) | |
r_sep$TimeClean <- substring(r_sep$Time1,3,nchar(r_sep$Time1)-2) | |
r_sep$TimeClean <- gsub("\\},\\{", "zzz", r_sep$TimeClean) |
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
# Get induced temporal rules from frequent itemsets | |
r1 <- as(ruleInduction(s1, confidence = 0.5, control = list(verbose = TRUE)), "data.frame") |
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(checkpoint) | |
checkpoint("2018-08-14") | |
library(fortunes) | |
library(mscstts) | |
set_ms_tts_key("8e61ae64924647d1a2833d68eeced78e") | |
out <- ms_synthesize("hello, world!", output_format = "audio-16khz-128kbitrate-mono-mp3") | |
f <- tempfile(fileext=".mp3") | |
writeBin(out$content, f) |
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
azure_mosaic <- readPNG("azure.png") %>% | |
scale_image(64) %>% | |
legoize() %>% | |
collect_bricks() | |
azure_mosaic %>% display_set("Bit and Azure") |
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
hotdog_predict <- function(imageURL, threshold = 0.5) { | |
predURL <- paste0(cvision_api_endpoint_pred, "/", cvision_id,"/url?", | |
"iterationId=",train.id, | |
"&application=R" | |
) | |
body.pred <- toJSON(list(Url=imageURL[1]), auto_unbox = TRUE) | |
APIresponse = POST(url = predURL, | |
content_type_json(), |
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
random_image <- function() { | |
## Return the URL random image in Wikimedia Commons | |
random_query <- paste0("https://commons.wikimedia.org/w/api.php?", | |
"action=query", | |
"&generator=random", # get a random page | |
"&grnlimit=1", # return 1 page | |
"&grnnamespace=6", # category: File | |
"&prop=imageinfo", | |
"&iiprop=url|size|extmetadata", | |
"&iiurlheight=1080", # limit images height (sometimes) |
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(tidyverse) | |
library(stringr) | |
library(stringi) | |
simplify_name <- function(n) | |
## Extract just the name, removing any quotes, and normalize accented characters | |
stri_trans_general(str_trim(str_match(n,"^[\'\"]?([^\'\",(<]+).*<")[,2]),"latin-ascii") | |
pkglist <- tools::CRAN_package_db() | |
pkglist <- tbl_df(pkglist[-40]) ## remove duplicate MD5sum column | |
pkglist %>% | |
select(Maintainer, Author, Package) %>% |
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
{ | |
"name": "davidsmiDAP8p", | |
"vmSize": "Standard_D2_v2", | |
"maxTasksPerNode": 4, | |
"poolSize": { | |
"dedicatedNodes": { | |
"min": 0, | |
"max": 0 | |
}, | |
"lowPriorityNodes": { |