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(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 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
| azure_mosaic <- readPNG("azure.png") %>% | |
| scale_image(64) %>% | |
| legoize() %>% | |
| collect_bricks() | |
| azure_mosaic %>% display_set("Bit and Azure") |
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
| 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 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
| image_caption <- function(URL) { | |
| reqURL = paste0(vision_api_endpoint, | |
| "/analyze?visualFeatures=Description", | |
| "&details=Celebrities,Landmarks") | |
| APIresponse = POST(url = reqURL, | |
| content_type('application/json'), | |
| add_headers(.headers = c('Ocp-Apim-Subscription-Key' = vision_api_key)), | |
| body=list(url = URL), | |
| encode = "json") |
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
| 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 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(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 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
| --- | |
| title: "Outliers are a matter of opinion?" | |
| author: "Antony Unwin" | |
| date: ' ' | |
| output: html_document | |
| --- | |
| ```{r include=FALSE} | |
| library(ggplot2) | |
| library(ggthemes) | |
| library(OutliersO3) |
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
| { | |
| "name": "davidsmiDAP8p", | |
| "vmSize": "Standard_D2_v2", | |
| "maxTasksPerNode": 4, | |
| "poolSize": { | |
| "dedicatedNodes": { | |
| "min": 0, | |
| "max": 0 | |
| }, | |
| "lowPriorityNodes": { |
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
| { | |
| "name": "davidsmiDAP8", | |
| "vmSize": "Standard_D2_v2", | |
| "maxTasksPerNode": 8, | |
| "poolSize": { | |
| "dedicatedNodes": { | |
| "min": 8, | |
| "max": 8 | |
| }, | |
| "lowPriorityNodes": { |
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(doParallel) | |
| cl <- makeCluster(2) | |
| registerDoParallel(cl) | |
| bdayp <- foreach(n=1:100) %dopar% pbirthdaysim(n) | |
| bdayp <- unlist(bdapy) |