Skip to content

Instantly share code, notes, and snippets.

View trestletech's full-sized avatar

Jeff Allen trestletech

View GitHub Profile
@trestletech
trestletech / server.R
Last active December 15, 2023 15:06
Show the headers in a Shiny app
library(shiny)
shinyServer(function(input, output, session) {
output$summary <- renderText({
ls(env=session$request)
})
output$headers <- renderUI({
selectInput("header", "Header:", ls(env=session$request))
@trestletech
trestletech / instance-types.sh
Created June 15, 2016 16:41
Get all EC2 Instance Types in All Availability Zones
#!/bin/bash
echo "Getting list of Availability Zones"
all_regions=$(aws ec2 describe-regions --output text --query 'Regions[*].[RegionName]' | sort)
all_az=()
while read -r region; do
az_per_region=$(aws ec2 describe-availability-zones --region $region --query 'AvailabilityZones[*].[ZoneName]' --output text | sort)
while read -r az; do
@trestletech
trestletech / server.R
Last active April 26, 2023 12:44
Example Shiny App showing the number of current sessions.
library(shiny)
# Create a reactive object here that we can share between all the sessions.
vals <- reactiveValues(count=0)
shinyServer(function(input, output, session) {
# Increment the number of sessions when one is opened.
# We use isolate() here to:
# a.) Provide a reactive context
@trestletech
trestletech / server.R
Last active August 1, 2022 14:12
Sample Shiny application demonstrating usage of Shiny Server Pro's authentication feature to customize the app according to the privileges of the logged-in user.
library(shiny)
library(ggplot2)
# Get the current day of the month
dom <- 25
# Define the target for salespeople in our organization.
salesTarget <- 15000
# Set the seed so we always get the same data.
@trestletech
trestletech / server.R
Last active February 2, 2022 09:47
A Shiny app combining the use of dplyr and SQLite. The goal is to demonstrate a full-fledged, database-backed user authorization framework in Shiny.
library(shiny)
library(dplyr)
library(lubridate)
# Load libraries and functions needed to create SQLite databases.
library(RSQLite)
library(RSQLite.extfuns)
saveSQLite <- function(data, name){
path <- dplyr:::db_location(filename=paste0(name, ".sqlite"))
@trestletech
trestletech / hidden.Rmd
Created April 17, 2014 15:46
includeRmd in Shiny
---
title: "hidden"
output: html_document
---
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r}
@trestletech
trestletech / server.R
Last active July 10, 2020 14:49
Shiny app used for debugging Shiny Server Pro Auth
library(shiny)
shinyServer(function(input, output, session) {
output$shinyVer <- reactive({
packageVersion("shiny")
})
output$rmarkdownVer <- reactive({
packageVersion("rmarkdown")
})
@trestletech
trestletech / README.md
Last active March 12, 2020 12:27
Shiny Example #1 for Bioconductor

Bioconductor Shiny Example #1

Simple app comparing the expression of genes between Tumor and Normal tissue.

This is an example Shiny app featuring some basic analysis of Ovarian Cancer gene expression data collected on the Affymetrix U133A platform. We filter the available genes and samples down to a much smaller matrix to make reproducibility simpler for a broader audience. The R code involved in sampling the data is available in this Gist as an R-Markdown file, and the sampled data are available in this Gist as Rds files.

To run the application, install shiny (install.packages("shiny")) then run the following command:

library(shiny)

@trestletech
trestletech / integration-testing.Rmd
Last active November 4, 2019 15:41
Integration testing vignette for the Shiny Dev center.
---
title: "Integration Testing in Shiny"
output: github_document
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
@trestletech
trestletech / README.md
Last active September 25, 2019 17:43
Shiny Example #2 for Bioconductor

Bioconductor Shiny Example #2

A demonstration of Shiny's text widget support.

This is an example Shiny app featuring some basic analysis of Ovarian Cancer gene expression data collected on the Affymetrix U133A platform. We filter the available genes and samples down to a much smaller matrix to make reproducibility simpler for a broader audience. The R code involved in sampling the data is available in this Gist as an R-Markdown file, and the sampled data are available in this Gist as Rds files.

To run the application, install shiny (install.packages("shiny")) then run the following command:

library(shiny)