# Packages ----
library(arrow)
Attaching package: 'arrow'
# Pi Simulation ---- | |
estimate_pi <- function(n = 10000) { | |
z <- replicate(n, sqrt(runif(1, -1, 1)^2 + runif(1, -1, 1)^2)) | |
4*sum((z<=1))/length(z) | |
} | |
n_sims <- 100000 | |
# Active window | |
(results_active <- bench::mark(estimate_pi(n_sims), min_time = Inf, max_iterations = 20)) |
# API1.R | |
library(plumber) | |
library(mypkg) | |
# Logging Stuffs | |
#* @post /foo | |
function() { | |
mypkg::foo() | |
} |
Building Jupyter notebook... | |
Bundle created with Python version 3.9.0 is compatible with environment Local with Python version 3.9.0 from /opt/python/3.9.0/bin/python3.9 | |
Bundle requested Python version 3.9.0; using /opt/python/3.9.0/bin/python3.9 which has version 3.9.0 | |
2021/11/15 23:13:56.187554195 Running on host: usw2-prd-rstd03 | |
2021/11/15 23:13:56.187572790 Environment will be built with Python "3.9.0 | packaged by conda-forge | (default, Nov 26 2020, 07:57:39) [GCC 9.3.0]" at /opt/python/3.9.0/bin/python3.9 | |
2021/11/15 23:13:56.187782318 Running as user: rstudio-connect | |
2021/11/15 23:13:56.214056251 Skipped packages: rsp-jupyter==1.4.1717, setuptools==58.5.1 | |
2021/11/15 23:13:56.214065199 Using cached environment: u9lAJLJ_6f3fVxMrMJ4oiQ | |
2021/11/15 23:13:57.257138517 WARNING: The directory '/home_efs/rstudio-connect/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with s |
from fastapi import FastAPI | |
from fastapi.responses import RedirectResponse | |
import uvicorn | |
app = FastAPI( | |
title = "Hello World" | |
) | |
@app.get("/") | |
async def home(): |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<!-- Applications (such as Dictionary.app) can recognize that a | |
webpage has been restricted by looking for the following comment: --> | |
<!-- com.apple.parentalcontrols.webcontentfilter.accessrestricted --> | |
<title>Access Restricted</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
# Example from https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started | |
library(rstan) | |
schools_dat <- list(J = 8, | |
y = c(28, 8, -3, 7, -1, 1, 18, 12), | |
sigma = c(15, 10, 16, 11, 9, 11, 10, 18)) | |
fit <- stan(model_code = ' | |
data { | |
int<lower=0> J; // number of schools |
I hereby claim:
To claim this, I am signing this object:
--- | |
title: Scraping Friends | |
description: An adventure with `rvest` | |
author: James Blair | |
date: '2017-07-18' | |
slug: friends | |
categories: [] | |
tags: | |
- R | |
- SoDS17 |
--- | |
title: Scraping Friends | |
description: An adventure with `rvest` | |
author: James Blair | |
date: '2017-07-18' | |
slug: friends | |
categories: [] | |
tags: | |
- R | |
- SoDS17 |